Fix Test
This commit is contained in:
parent
a6b23a739f
commit
e947921955
@ -30,5 +30,5 @@ dispatchNotificationCorrectionsAssigned nUser nSheet jRecipient = do
|
|||||||
|
|
||||||
editNotifications <- mkEditNotifications jRecipient
|
editNotifications <- mkEditNotifications jRecipient
|
||||||
|
|
||||||
addAlternatives $ do
|
addAlternatives $
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/correctionsAssigned.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/correctionsAssigned.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|||||||
@ -29,5 +29,5 @@ dispatchNotificationSheetActive nSheet jRecipient = userMailT jRecipient $ do
|
|||||||
|
|
||||||
editNotifications <- mkEditNotifications jRecipient
|
editNotifications <- mkEditNotifications jRecipient
|
||||||
|
|
||||||
addAlternatives $ do
|
addAlternatives $
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/sheetActive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/sheetActive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|||||||
@ -32,7 +32,7 @@ dispatchNotificationSheetSoonInactive nSheet jRecipient = userMailT jRecipient $
|
|||||||
|
|
||||||
editNotifications <- mkEditNotifications jRecipient
|
editNotifications <- mkEditNotifications jRecipient
|
||||||
|
|
||||||
addAlternatives $ do
|
addAlternatives $
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/sheetSoonInactive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/sheetSoonInactive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|
||||||
dispatchNotificationSheetInactive :: SheetId -> UserId -> Handler ()
|
dispatchNotificationSheetInactive :: SheetId -> UserId -> Handler ()
|
||||||
@ -58,6 +58,6 @@ dispatchNotificationSheetInactive nSheet jRecipient = userMailT jRecipient $ do
|
|||||||
|
|
||||||
editNotifications <- mkEditNotifications jRecipient
|
editNotifications <- mkEditNotifications jRecipient
|
||||||
|
|
||||||
addAlternatives $ do
|
addAlternatives $
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/sheetInactive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/sheetInactive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,6 @@ dispatchNotificationUserRightsUpdate nUser _originalRights jRecipient = userMai
|
|||||||
setSubjectI $ MsgMailSubjectUserRightsUpdate userDisplayName
|
setSubjectI $ MsgMailSubjectUserRightsUpdate userDisplayName
|
||||||
-- MsgRenderer mr <- getMailMsgRenderer
|
-- MsgRenderer mr <- getMailMsgRenderer
|
||||||
editNotifications <- mkEditNotifications jRecipient
|
editNotifications <- mkEditNotifications jRecipient
|
||||||
addAlternatives $ do
|
addAlternatives $
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/userRightsUpdate.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/userRightsUpdate.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|
||||||
|
|||||||
@ -136,8 +136,8 @@ bearerToken :: forall m.
|
|||||||
-> Maybe UTCTime -- ^ @Nothing@ means token starts to be valid immediately
|
-> Maybe UTCTime -- ^ @Nothing@ means token starts to be valid immediately
|
||||||
-> m (BearerToken (HandlerSite m))
|
-> m (BearerToken (HandlerSite m))
|
||||||
bearerToken tokenAuthority tokenRoutes tokenAddAuth mTokenExpiresAt tokenStartsAt = do
|
bearerToken tokenAuthority tokenRoutes tokenAddAuth mTokenExpiresAt tokenStartsAt = do
|
||||||
tokenIdentifier <- liftIO $ getRandom
|
tokenIdentifier <- liftIO getRandom
|
||||||
tokenIssuedAt <- liftIO $ getCurrentTime
|
tokenIssuedAt <- liftIO getCurrentTime
|
||||||
tokenIssuedBy <- getsYesod $ view instanceID
|
tokenIssuedBy <- getsYesod $ view instanceID
|
||||||
|
|
||||||
defaultExpiration <- getsYesod $ view _appJWTExpiration
|
defaultExpiration <- getsYesod $ view _appJWTExpiration
|
||||||
|
|||||||
11
test.sh
11
test.sh
@ -1,3 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
move-back() {
|
||||||
|
mv -v .stack-work .stack-work-test
|
||||||
|
[[ -d .stack-work-build ]] && mv -v .stack-work-build .stack-work
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -d .stack-work-test ]]; then
|
||||||
|
[[ -d .stack-work ]] && mv -v .stack-work .stack-work-build
|
||||||
|
mv -v .stack-work-test .stack-work
|
||||||
|
trap move-back EXIT
|
||||||
|
fi
|
||||||
|
|
||||||
exec -- stack build --test --fast --flag uniworx:dev --flag uniworx:library-only ${@}
|
exec -- stack build --test --fast --flag uniworx:dev --flag uniworx:library-only ${@}
|
||||||
|
|||||||
@ -94,6 +94,7 @@ fillDb = do
|
|||||||
{ userIdent = "G.Kleen@campus.lmu.de"
|
{ userIdent = "G.Kleen@campus.lmu.de"
|
||||||
, userAuthentication = AuthLDAP
|
, userAuthentication = AuthLDAP
|
||||||
, userLastAuthentication = Just now
|
, userLastAuthentication = Just now
|
||||||
|
, userTokensIssuedAfter = Just now
|
||||||
, userMatrikelnummer = Nothing
|
, userMatrikelnummer = Nothing
|
||||||
, userEmail = "G.Kleen@campus.lmu.de"
|
, userEmail = "G.Kleen@campus.lmu.de"
|
||||||
, userDisplayName = "Gregor Kleen"
|
, userDisplayName = "Gregor Kleen"
|
||||||
@ -111,6 +112,7 @@ fillDb = do
|
|||||||
{ userIdent = "felix.hamann@campus.lmu.de"
|
{ userIdent = "felix.hamann@campus.lmu.de"
|
||||||
, userAuthentication = AuthLDAP
|
, userAuthentication = AuthLDAP
|
||||||
, userLastAuthentication = Nothing
|
, userLastAuthentication = Nothing
|
||||||
|
, userTokensIssuedAfter = Nothing
|
||||||
, userMatrikelnummer = Nothing
|
, userMatrikelnummer = Nothing
|
||||||
, userEmail = "felix.hamann@campus.lmu.de"
|
, userEmail = "felix.hamann@campus.lmu.de"
|
||||||
, userDisplayName = "Felix Hamann"
|
, userDisplayName = "Felix Hamann"
|
||||||
@ -128,6 +130,7 @@ fillDb = do
|
|||||||
{ userIdent = "jost@tcs.ifi.lmu.de"
|
{ userIdent = "jost@tcs.ifi.lmu.de"
|
||||||
, userAuthentication = AuthLDAP
|
, userAuthentication = AuthLDAP
|
||||||
, userLastAuthentication = Nothing
|
, userLastAuthentication = Nothing
|
||||||
|
, userTokensIssuedAfter = Nothing
|
||||||
, userMatrikelnummer = Nothing
|
, userMatrikelnummer = Nothing
|
||||||
, userEmail = "jost@tcs.ifi.lmu.de"
|
, userEmail = "jost@tcs.ifi.lmu.de"
|
||||||
, userDisplayName = "Steffen Jost"
|
, userDisplayName = "Steffen Jost"
|
||||||
@ -145,6 +148,7 @@ fillDb = do
|
|||||||
{ userIdent = "max@campus.lmu.de"
|
{ userIdent = "max@campus.lmu.de"
|
||||||
, userAuthentication = AuthLDAP
|
, userAuthentication = AuthLDAP
|
||||||
, userLastAuthentication = Just now
|
, userLastAuthentication = Just now
|
||||||
|
, userTokensIssuedAfter = Nothing
|
||||||
, userMatrikelnummer = Just "1299"
|
, userMatrikelnummer = Just "1299"
|
||||||
, userEmail = "max@campus.lmu.de"
|
, userEmail = "max@campus.lmu.de"
|
||||||
, userDisplayName = "Max Musterstudent"
|
, userDisplayName = "Max Musterstudent"
|
||||||
@ -162,6 +166,7 @@ fillDb = do
|
|||||||
{ userIdent = "tester@campus.lmu.de"
|
{ userIdent = "tester@campus.lmu.de"
|
||||||
, userAuthentication = AuthLDAP
|
, userAuthentication = AuthLDAP
|
||||||
, userLastAuthentication = Nothing
|
, userLastAuthentication = Nothing
|
||||||
|
, userTokensIssuedAfter = Nothing
|
||||||
, userMatrikelnummer = Just "999"
|
, userMatrikelnummer = Just "999"
|
||||||
, userEmail = "tester@campus.lmu.de"
|
, userEmail = "tester@campus.lmu.de"
|
||||||
, userDisplayName = "Tina Tester"
|
, userDisplayName = "Tina Tester"
|
||||||
|
|||||||
@ -41,6 +41,7 @@ instance Arbitrary User where
|
|||||||
]
|
]
|
||||||
userAuthentication <- arbitrary
|
userAuthentication <- arbitrary
|
||||||
userLastAuthentication <- arbitrary
|
userLastAuthentication <- arbitrary
|
||||||
|
userTokensIssuedAfter <- arbitrary
|
||||||
userMatrikelnummer <- fmap pack . assertM' (not . null) <$> listOf (elements ['0'..'9'])
|
userMatrikelnummer <- fmap pack . assertM' (not . null) <$> listOf (elements ['0'..'9'])
|
||||||
userEmail <- CI.mk . decodeUtf8 . Email.toByteString <$> arbitrary
|
userEmail <- CI.mk . decodeUtf8 . Email.toByteString <$> arbitrary
|
||||||
|
|
||||||
|
|||||||
@ -103,11 +103,12 @@ authenticateAs (Entity _ User{..}) = do
|
|||||||
-- checking is switched off in wipeDB for those database backends which need it.
|
-- checking is switched off in wipeDB for those database backends which need it.
|
||||||
createUser :: (User -> User) -> YesodExample UniWorX (Entity User)
|
createUser :: (User -> User) -> YesodExample UniWorX (Entity User)
|
||||||
createUser adjUser = do
|
createUser adjUser = do
|
||||||
UserDefaultConf{..} <- appUserDefaults . appSettings <$> getTestYesod
|
UserDefaultConf{..} <- appUserDefaults . view appSettings <$> getTestYesod
|
||||||
let
|
let
|
||||||
userMatrikelnummer = Nothing
|
userMatrikelnummer = Nothing
|
||||||
userAuthentication = AuthLDAP
|
userAuthentication = AuthLDAP
|
||||||
userLastAuthentication = Nothing
|
userLastAuthentication = Nothing
|
||||||
|
userTokensIssuedAfter = Nothing
|
||||||
userIdent = "dummy@example.invalid"
|
userIdent = "dummy@example.invalid"
|
||||||
userEmail = "dummy@example.invalid"
|
userEmail = "dummy@example.invalid"
|
||||||
userDisplayName = "Dummy Example"
|
userDisplayName = "Dummy Example"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user