wai-test-1.3.0.5: Unit test framework (built on HUnit) for WAI applications.

Safe Haskell | None

Network.Wai.Test

Contents

- Session
- Requests
- Assertions

Synopsis

- type Session = ReaderT Application (StateT ClientState IO)
- runSession :: Session a -> Application -> IO a
- request :: Request -> Session SResponse
- srequest :: SRequest -> Session SResponse
- data SRequest = SRequest {
  - simpleRequest :: Request
  - simpleRequestBody :: ByteString
  }
- data SResponse = SResponse {
  - simpleStatus :: Status
  - simpleHeaders :: ResponseHeaders
  - simpleBody :: ByteString
  }
- defaultRequest :: Request
- setRawPathInfo :: Request -> ByteString -> Request
- assertStatus :: Int -> SResponse -> Session ()
- assertContentType :: ByteString -> SResponse -> Session ()
- assertBody :: ByteString -> SResponse -> Session ()
- assertBodyContains :: ByteString -> SResponse -> Session ()
- assertHeader :: CI ByteString -> ByteString -> SResponse -> Session ()
- assertNoHeader :: CI ByteString -> SResponse -> Session ()

# Session

type Session = ReaderT Application (StateT ClientState IO)Source

runSession :: Session a -> Application -> IO aSource

# Requests

request :: Request -> Session SResponse Source

srequest :: SRequest -> Session SResponse Source

data SRequest Source

Constructors

SRequest |

Fields

simpleRequest :: Request
simpleRequestBody :: ByteString

data SResponse Source

Constructors

SResponse |

Fields

simpleStatus :: Status
simpleHeaders :: ResponseHeaders
simpleBody :: ByteString

Instances

Eq SResponse |
Show SResponse |

defaultRequest :: Request Source

setRawPathInfo :: Request -> ByteString -> Request Source

# Assertions

assertStatus :: Int -> SResponse -> Session ()Source

assertContentType :: ByteString -> SResponse -> Session ()Source

assertBody :: ByteString -> SResponse -> Session ()Source

assertBodyContains :: ByteString -> SResponse -> Session ()Source

assertHeader :: CI ByteString -> ByteString -> SResponse -> Session ()Source

assertNoHeader :: CI ByteString -> SResponse -> Session ()Source