Safe HaskellNone

IHP.Test.Mocking

Synopsis

Documentation

type ContextParameters application = (?applicationContext :: ApplicationContext, ?context :: RequestContext, ?modelContext :: ModelContext, ?application :: application, InitControllerContext application, ?mocking :: MockContext application) Source #

mockContext :: InitControllerContext application => application -> ConfigBuilder -> IO (MockContext application) Source #

Create contexts that can be used for mocking

withContext :: (ContextParameters application => IO a) -> MockContext application -> IO a Source #

Run a IO action, setting implicit params based on supplied mock context

setupWithContext :: (ContextParameters application => IO a) -> MockContext application -> IO (MockContext application) Source #

mockAction :: forall application controller. (Controller controller, ContextParameters application) => controller -> IO Response Source #

Runs a controller action in a mock environment

mockActionResponse :: forall application controller. (Controller controller, ContextParameters application) => controller -> IO ByteString Source #

Get contents of response

mockActionStatus :: forall application controller. (Controller controller, ContextParameters application) => controller -> IO Status Source #

Get HTTP status of the controller

withParams :: [Param] -> (ContextParameters application => IO a) -> MockContext application -> IO a Source #

Add params to the request context, run the action

headers :: IO Response -> IO ResponseHeaders Source #

responseBody :: Response -> IO ByteString Source #