fix(tests): explicit post parameter name for dummy login

This commit is contained in:
Gregor Kleen 2019-10-31 17:23:30 +01:00
parent 9ba0e27ba2
commit 2ccd50fa85
3 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ dummyForm :: ( RenderMessage (HandlerSite m) FormMessage
) => AForm m (CI Text)
dummyForm = wFormToAForm $ do
mr <- getMessageRender
aFormToWForm $ areq (ciField & addDatalist userList) (fslpI MsgDummyIdent (mr MsgDummyIdentPlaceholder) & noAutocomplete) Nothing
aFormToWForm $ areq (ciField & addDatalist userList) (fslpI MsgDummyIdent (mr MsgDummyIdentPlaceholder) & noAutocomplete & addName PostLoginDummy) Nothing
where
userList = fmap mkOptionList . runDB $ withReaderT projectBackend (map toOption <$> selectList [] [Asc UserIdent] :: ReaderT SqlBackend _ [Option UserIdent])
toOption (Entity _ User{..}) = Option userDisplayName userIdent (CI.original userIdent)

View File

@ -56,6 +56,7 @@ data GlobalPostParam = PostFormIdentifier
| PostMassInputShape
| PostBearer
| PostDBCsvImportAction
| PostLoginDummy
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
instance Universe GlobalPostParam

View File

@ -61,6 +61,9 @@ import Data.Typeable
import Handler.Utils (runAppLoggingT)
import Web.PathPieces (toPathPiece)
import Utils.Parameters (GlobalPostParam(PostLoginDummy))
runDB :: SqlPersistM a -> YesodExample UniWorX a
runDB query = do
@ -108,7 +111,7 @@ authenticateAs (Entity _ User{..}) = do
request $ do
setMethod "POST"
addToken_ "#login--dummy"
byLabelExact "Identifikation" $ CI.original userIdent
addPostParam (toPathPiece PostLoginDummy) $ CI.original userIdent
setUrl $ AuthR $ PluginR "dummy" []
-- | Create a user. The dummy email entry helps to confirm that foreign-key