Skip to content

Commit c5929df

Browse files
committed
debugging integration tests [WIP]
1 parent d568ea4 commit c5929df

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

integration/test/SetupHelpers.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,12 @@ loginWithSamlWithZHost mbZHost domain expectSuccess tid nameId (iid, (meta, priv
522522
let spMetaData = toSPMetaData spmeta.body
523523
parsedAuthnReq = parseAuthnReqResp authnreq.body
524524
authnReqResp <- makeAuthnResponse nameId privcreds idpConfig spMetaData parsedAuthnReq
525+
526+
-- in the next line, validateLoginResp fails: we expect success (and on develop we get it), but here we get --
525527
mUid <- finalizeSamlLoginWithZHost domain mbZHost tid authnReqResp `bindResponse` validateLoginResp
528+
529+
-- <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head> <title>wire:sso:success</title> <script type="text/javascript"> const receiverOrigin = '*'; ; </script></head></html>
530+
526531
pure (mUid, authnReqResp)
527532
where
528533
toSPMetaData :: ByteString -> SAML.SPMetadata
@@ -555,6 +560,7 @@ loginWithSamlWithZHost mbZHost domain expectSuccess tid nameId (iid, (meta, priv
555560
hasPersistentCookieHeader :: Response -> App (Maybe String)
556561
hasPersistentCookieHeader rsp = do
557562
let mCookie = getCookie "zuid" rsp
563+
() <- error $ show (rsp, mCookie) -- in testIdpUpdateMinimal, there should be a set-cookie header, but there isn't.
558564
case mCookie of
559565
Nothing -> do
560566
expectSuccess `shouldMatch` False

integration/test/Test/Spar.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,25 @@ testIdpUpdate = do
886886
for_ uids $ \(_, email) -> do
887887
void $ loginWithSamlEmail True tid email idp3
888888

889+
testIdpUpdateMinimal :: (HasCallStack) => App ()
890+
testIdpUpdateMinimal = do
891+
(owner, tid, []) <- createTeam OwnDomain 1
892+
void $ setTeamFeatureStatus owner tid "sso" "enabled"
893+
-- register an IdP
894+
idp@(idpId, _) <- do
895+
(resp, meta) <- registerTestIdPWithMetaWithPrivateCreds owner
896+
(,meta) <$> asString (resp.json %. "id")
897+
-- create a SCIM token
898+
tok <-
899+
createScimToken owner (def {idp = Just idpId}) `bindResponse` \resp -> do
900+
resp.status `shouldMatchInt` 200
901+
resp.json %. "token" >>= asString
902+
-- create a user via scim and try to login with saml
903+
scimUser <- randomScimUser
904+
createScimUser owner tok scimUser >>= assertSuccess
905+
email <- scimUser %. "emails" >>= asList >>= assertOne >>= (%. "value") >>= asString
906+
void $ loginWithSamlEmail True tid email idp
907+
889908
-- @SF.Provisioning @TSFI.RESTfulAPI @S2
890909
--
891910
-- Allow updates of E2EI enabled users only via SCIM

0 commit comments

Comments
 (0)