http-test 0.2.3 → 0.2.4
raw patch · 2 files changed
+10/−8 lines, 2 filesdep +lens-aesondep ~lens
Dependencies added: lens-aeson
Dependency ranges changed: lens
Files
- http-test.cabal +7/−6
- src/Test/HTTP.hs +3/−2
http-test.cabal view
@@ -1,7 +1,7 @@ Name: http-test-Version: 0.2.3+Version: 0.2.4 synopsis: Test framework for HTTP APIs-Description: A simple framework for making assertions about the +Description: A simple framework for making assertions about the responses of HTTP servers. . > import Test.HTTP@@ -9,9 +9,9 @@ > > main = defaultMain $ httpTestCase "BayesHive landing page" "https://bayeshive.com" $ do > landing <- get "/"- > assert "Correct blog link" $ + > assert "Correct blog link" $ > "href=\"https://bayeshive.com/blog\"" `isInfixOf` landing- > loginResult <- postForm "/auth/page/email/login" + > loginResult <- postForm "/auth/page/email/login" > [("email", "foo"), ("password", "bar")] > debug loginResult @@ -34,14 +34,15 @@ Exposed-modules: Test.HTTP hs-source-dirs: src Build-depends: base >= 4 && < 5- , mtl + , mtl , aeson , wreq , tasty , tasty-hunit , text , bytestring- , lens+ , lens >= 4.4+ , lens-aeson , http-client , time
src/Test/HTTP.hs view
@@ -181,9 +181,10 @@ -- | Print the number of seconds elapsed, with a prefix -toc :: Session Double-toc = do+toc :: String -> Session Double+toc s = do last <- fmap timer $ S.get now <- liftIO $ getCurrentTime let df = diffUTCTime now last+ liftIO $ putStrLn $ s ++ " "++show df return $ realToFrac df