| Safe Haskell | None |
|---|
Test.HTTP
- httpTest :: Program () -> IO ()
- session :: String -> String -> Session () -> Program ()
- get :: String -> Session String
- getJSON :: FromJSON a => String -> Session a
- withJSON :: FromJSON a => String -> (a -> Session ()) -> Session ()
- postForm :: String -> [(String, String)] -> Session String
- assert :: String -> Bool -> Session ()
- assertEq :: (Show a, Eq a) => String -> a -> a -> Session ()
- assertParse :: String -> Parser Bool -> Session ()
- debug :: String -> Session ()
- type Program = ReaderT (TVar [Results]) IO
- type Session a = StateT SessionState (ErrorT String IO) a
Documentation
httpTest :: Program () -> IO ()Source
Run one or more test sessions. httpTest will exit when done, with exit code 1 if there were failures
Arguments
| :: String | Session name (used for logging failures) |
| -> String | Base URL |
| -> Session () | the actions and assertions that define the session |
| -> Program () |
Define a single test session based on session name and base url
Arguments
| :: FromJSON a | |
| => String | URL |
| -> (a -> Session ()) | action to perform on successfully decoded value |
| -> Session () |
perform an action with a JSON value from a GET
Arguments
| :: String | assertion name (used for reporting failures |
| -> Bool | Boolean of which we are asserting truth |
| -> Session () |
make an assertion
Arguments
| :: (Show a, Eq a) | |
| => String | assertion name (used for reporting failures |
| -> a | a value |
| -> a | what it is meant to be equal to |
| -> Session () |
assert equality, for better output messages
Arguments
| :: String | assertion name (used for reporting failures |
| -> Parser Bool | Boolean of which we are asserting truth |
| -> Session () |
make an assertion in the Parser monad, ofr use with JSON value