Safe Haskell | None |
---|---|
Language | Haskell2010 |
- testUserForms :: [UserFormData]
- testUsers :: [User]
- testUser :: User
- testUid :: UserId
- testHashedSecret :: HashedSecret ServiceKey
- addTestUser :: Int -> Action Void s (UserId, UserFormData, User)
- initializeTestUsers :: Action Void s [(UserId, UserFormData, User)]
- encryptTestSecret :: ByteString -> HashedSecret a
- servId :: ServiceId
- cxtName :: ContextName
- cxtDesc :: ContextDescription
- cxtUrl :: ProxyUri
- persName :: PersonaName
- withLogger :: IO a -> IO a
- withLogger' :: IO a -> IO a
- withNoisyLogger :: IO a -> IO a
- withNoisyLogger' :: IO a -> IO a
- _withLogger :: Bool -> IO a -> IO a
- withWebDriver :: WD r -> IO r
- withWebDriver' :: WD r -> IO r
- withWebDriverAt' :: String -> Int -> WD r -> IO r
- withFrontend :: HttpConfig -> ActionState -> IO r -> IO r
- withFrontend' :: HttpConfig -> ActionState -> IO r -> IO r
- withBackend :: HttpConfig -> ActionState -> IO r -> IO r
- withBackend' :: HttpConfig -> ActionState -> IO r -> IO r
- withFrontendAndBackend :: String -> (ActionState -> IO r) -> IO r
- withFrontendAndBackend' :: String -> (ActionState -> IO r) -> IO r
- createActionState :: String -> ThentosConfig -> IO ActionState
- createDb :: String -> IO (Pool Connection)
- loginAsGod :: ActionState -> IO (ThentosSessionToken, [Header])
- decodeLenient :: FromJSON a => LBS -> Either String a
- (..=) :: ST -> ST -> Pair
test users
addTestUser :: Int -> Action Void s (UserId, UserFormData, User)
Add a single test user (with fast scrypt params) from testUsers
to the database and return
it.
initializeTestUsers :: Action Void s [(UserId, UserFormData, User)]
Create a list of test users (with fast scrypt params), store them in the database, and return them for use in test cases.
encryptTestSecret :: ByteString -> HashedSecret a
Sample data for making services, contexts, and personas
runners
withLogger :: IO a -> IO a
withLogger' :: IO a -> IO a
Run an action, logging everything with DEBUG
level to ./everything.log
.
withNoisyLogger :: IO a -> IO a
withNoisyLogger' :: IO a -> IO a
this is a workaround for the fact that log file contents is not included in the output of
failing test cases. If you replace the call to withLogger
with one ot withNoisyLogger
in a
test, everything will go to stderr immediately.
FIXME: include log contents in failing test cases.
FIXME: while we are at it, it would be really cool (and not that hard) to provide a log handler
that logs into a Chan
, and expose the Chan to the tests. that would make it easy to use log
file contents to formulate tests.
_withLogger :: Bool -> IO a -> IO a
withWebDriver :: WD r -> IO r
withWebDriver' :: WD r -> IO r
Start and shutdown webdriver on localhost:4451, running the action in between.
withWebDriverAt' :: String -> Int -> WD r -> IO r
Start and shutdown webdriver on the specified host and port, running the action in between.
withFrontend :: HttpConfig -> ActionState -> IO r -> IO r
withFrontend' :: HttpConfig -> ActionState -> IO r -> IO r
Start and shutdown the frontend in the specified HttpConfig
and with the
specified DB, running an action in between.
withBackend :: HttpConfig -> ActionState -> IO r -> IO r
withBackend' :: HttpConfig -> ActionState -> IO r -> IO r
Run a hspec-wai
Session
with the backend Application
.
withFrontendAndBackend :: String -> (ActionState -> IO r) -> IO r
withFrontendAndBackend' :: String -> (ActionState -> IO r) -> IO r
Sets up DB, frontend and backend, creates god user, runs an action that takes a DB, and tears down everything, returning the result of the action.
set up state
createActionState :: String -> ThentosConfig -> IO ActionState
Create an ActionState
with a connection to an empty DB and the specified
config.
createDb :: String -> IO (Pool Connection)
Create a connection to an empty DB.
FIXME: the tests shouldn't have to pick a database name. it should work like withLogger
in
that it finds a free suitable database name, and garbage-collects the database when the test is
done.
loginAsGod :: ActionState -> IO (ThentosSessionToken, [Header])
misc
decodeLenient :: FromJSON a => LBS -> Either String a
Like decode
but allows all JSON values instead of just
objects and arrays.
FIXME: upgrade to aeson >= 0.10 and use eitherDecode
instead of this: See
4b370592242d4e4367ca46d852109c3927210f4b. for this to work, we need to either upgrade pronk
(criterion in particular) benchmarking or, preferably, factor it out into a separate package.
(..=) :: ST -> ST -> Pair
This is convenient if you have lots of string literals with -XOverloadedStrings
but do not
want to do explicit type signatures to avoid type ambiguity.