mangopay 1.9.5.1 → 1.9.6
raw patch · 3 files changed
+9/−19 lines, 3 files
Files
- mangopay.cabal +1/−1
- src/Web/MangoPay/TestUtils.hs +7/−17
- test/mangopay-tests.hs +1/−1
mangopay.cabal view
@@ -1,5 +1,5 @@ name: mangopay-version: 1.9.5.1+version: 1.9.6 cabal-version: >= 1.8 build-type: Simple author: JP Moresmau <jpmoresmau@gmail.com>
src/Web/MangoPay/TestUtils.hs view
@@ -3,7 +3,6 @@ module Web.MangoPay.TestUtils ( -- * Initialization withMangoPayTestUtils- , withMangoPayTestUtils' -- * Test helpers , testCardInfo1@@ -242,23 +241,14 @@ -- server's root, while the second is the port this server -- should listen to. withMangoPayTestUtils- :: IO a- -- ^ Action to run while being able to use functions from- -- this module.- -> IO a-withMangoPayTestUtils = withMangoPayTestUtils' . const . const----- | Same as 'withMangoPayTestUtils', but also gives more--- information about the environment to the action.-withMangoPayTestUtils' :: ( Credentials+ -> AccessToken -> H.Manager -> IO a ) -- ^ Action to run while being able to use functions from -- this module. -> IO a-withMangoPayTestUtils' act =+withMangoPayTestUtils act = H.withManager $ \mgr -> liftIO $ do hook <- getHookEndPoint res <- newReceivedEvents@@ -270,7 +260,7 @@ bracket (startHTTPServer hook res) killThread- (const $ initializeTestState >>= flip act mgr)+ (const $ initializeTestState >>= \(creds, at) -> act creds at mgr) ----------------------------------------------------------------------@@ -359,16 +349,16 @@ -- (this file can be generated by mangopay-passphrase), -- generates a new id/name, keeps the same email and generates a new secret -- saves the secret to use in other tests.-initializeTestState :: IO Credentials+initializeTestState :: IO (Credentials, AccessToken) initializeTestState = do mgr <- getTestHttpManager creds <- createCredentials mgr- at <- createAccessToken mgr creds+ at <- toAccessToken <$> createAccessToken mgr creds I.modifyIORef testState $ \ts -> ts { tsCredentials = creds- , tsAccessToken = toAccessToken at }+ , tsAccessToken = at } listenForAll- return creds+ return (creds, at) -- | (Internal) Add the current time as a suffix to the client id
test/mangopay-tests.hs view
@@ -23,7 +23,7 @@ -- | Test entry point. main :: IO () main =- withMangoPayTestUtils $+ withMangoPayTestUtils $ \_ _ _ -> htfMain $ htf_importedTests ++ [htf_thisModulesTests]