File: integration.hs

package info (click to toggle)
haskell-yesod-auth-hashdb 1.7.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: haskell: 689; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE CPP                        #-}
{-# LANGUAGE OverloadedStrings          #-}

import Control.Monad.Trans.Resource (runResourceT)
import Control.Monad.Logger         (runStderrLoggingT)
import Database.Persist.Sqlite
import Network.HTTP.Client.Conduit  (newManager)
import Test.Hspec                   (hspec)
import Yesod
import Yesod.Auth.HashDB            (setPassword)

#ifndef STANDALONE
import IntegrationTest
#endif
import TestSite

main :: IO ()
main = runStderrLoggingT $ withSqliteConn ":memory:" $ \conn -> liftIO $ do
    runResourceT $ flip runSqlConn conn $ do
        runMigration migrateAll
        validUser <- setPassword "MyPassword" $ User "paul" Nothing
        insert_ validUser
    mgr <- newManager
#ifdef STANDALONE
    -- Run as a stand-alone server - see the cabal file in this directory
    warp 3000 $ App mgr conn
#else
    -- Otherwise run the tests
    hspec $ withApp (App mgr conn) integrationSpec
#endif