From 27dffe7d0895519a583db8cca5e090e8de51cc5c Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 28 Feb 2019 11:55:28 +0100 Subject: [PATCH] Fixbuild tests and linter --- src/Database/Esqueleto/Utils.hs | 2 +- test/Database.hs | 5 +++++ test/ModelSpec.hs | 5 +++-- test/TestImport.hs | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Database/Esqueleto/Utils.hs b/src/Database/Esqueleto/Utils.hs index 003b26168..158fa5bea 100644 --- a/src/Database/Esqueleto/Utils.hs +++ b/src/Database/Esqueleto/Utils.hs @@ -7,7 +7,7 @@ module Database.Esqueleto.Utils , SqlIn(..) ) where -import ClassyPrelude.Yesod hiding (isInfixOf, (||.), any, all) +import ClassyPrelude.Yesod hiding (isInfixOf, any, all) import qualified Data.Foldable as F import qualified Database.Esqueleto as E import Database.Esqueleto.Utils.TH diff --git a/test/Database.hs b/test/Database.hs index c4d6ad8e1..1d2b903ba 100755 --- a/test/Database.hs +++ b/test/Database.hs @@ -93,6 +93,7 @@ fillDb = do gkleen <- insert User { userIdent = "G.Kleen@campus.lmu.de" , userAuthentication = AuthLDAP + , userLastAuthentication = Just now , userMatrikelnummer = Nothing , userEmail = "G.Kleen@campus.lmu.de" , userDisplayName = "Gregor Kleen" @@ -109,6 +110,7 @@ fillDb = do fhamann <- insert User { userIdent = "felix.hamann@campus.lmu.de" , userAuthentication = AuthLDAP + , userLastAuthentication = Nothing , userMatrikelnummer = Nothing , userEmail = "felix.hamann@campus.lmu.de" , userDisplayName = "Felix Hamann" @@ -125,6 +127,7 @@ fillDb = do jost <- insert User { userIdent = "jost@tcs.ifi.lmu.de" , userAuthentication = AuthLDAP + , userLastAuthentication = Nothing , userMatrikelnummer = Nothing , userEmail = "jost@tcs.ifi.lmu.de" , userDisplayName = "Steffen Jost" @@ -141,6 +144,7 @@ fillDb = do maxMuster <- insert User { userIdent = "max@campus.lmu.de" , userAuthentication = AuthLDAP + , userLastAuthentication = Just now , userMatrikelnummer = Just "1299" , userEmail = "max@campus.lmu.de" , userDisplayName = "Max Musterstudent" @@ -157,6 +161,7 @@ fillDb = do tinaTester <- insert $ User { userIdent = "tester@campus.lmu.de" , userAuthentication = AuthLDAP + , userLastAuthentication = Nothing , userMatrikelnummer = Just "999" , userEmail = "tester@campus.lmu.de" , userDisplayName = "Tina Tester" diff --git a/test/ModelSpec.hs b/test/ModelSpec.hs index 33a54c2e3..258211f94 100644 --- a/test/ModelSpec.hs +++ b/test/ModelSpec.hs @@ -40,6 +40,7 @@ instance Arbitrary User where , on (\l d -> l <> "@" <> d) getPrintableString <$> arbitrary <*> arbitrary ] userAuthentication <- arbitrary + userLastAuthentication <- arbitrary userMatrikelnummer <- fmap pack . assertM' (not . null) <$> listOf (elements ['0'..'9']) userEmail <- CI.mk . decodeUtf8 . Email.toByteString <$> arbitrary @@ -60,7 +61,7 @@ instance Arbitrary User where userDownloadFiles <- arbitrary userMailLanguages <- arbitrary userNotificationSettings <- arbitrary - + return User{..} shrink = genericShrink @@ -71,7 +72,7 @@ instance Arbitrary File where fileModified <- (addUTCTime <$> arbitrary <*> pure (UTCTime date 0)) `suchThat` inZipRange fileContent <- arbitrary return File{..} - where + where inZipRange :: UTCTime -> Bool inZipRange time | time > UTCTime (fromGregorian 1980 1 1) 0 diff --git a/test/TestImport.hs b/test/TestImport.hs index 9d84e8722..f576ccf30 100644 --- a/test/TestImport.hs +++ b/test/TestImport.hs @@ -92,7 +92,7 @@ authenticateAs (Entity _ User{..}) = do setMethod "GET" addRequestHeader ("Accept-Language", "de") setUrl $ AuthR LoginR - + request $ do setMethod "POST" addToken_ "#login--dummy" @@ -107,6 +107,7 @@ createUser adjUser = do let userMatrikelnummer = Nothing userAuthentication = AuthLDAP + userLastAuthentication = Nothing userIdent = "dummy@example.invalid" userEmail = "dummy@example.invalid" userDisplayName = "Dummy Example"