@@ -526,11 +526,11 @@ testSparMigrateFromExternalIdOnlyToEmail (MkTagged emailUnchanged) = do
526526
527527 -- Verify that updating a user with an empty emails does not change the email
528528 bindResponse (updateScimUser OwnDomain tok userId scimUser) $ \ resp -> do
529- resp. json %. " emails" `shouldMatch` (toJSON [object [ " value " .= email] ])
529+ resp. json %. " emails" `shouldMatch` (toJSON [scimWorkEmail email])
530530 resp. status `shouldMatchInt` 200
531531
532532 newEmail <- if emailUnchanged then pure email else randomEmail
533- let newEmails = ( toJSON [object [ " value " .= newEmail]])
533+ let newEmails = toJSON [scimWorkEmail newEmail]
534534 updatedScimUser <- setField " emails" newEmails scimUser
535535 updateScimUser OwnDomain tok userId updatedScimUser `bindResponse` \ resp -> do
536536 resp. status `shouldMatchInt` 200
@@ -562,6 +562,12 @@ checkSparGetUserAndFindByExtId domain tok extId uid k = do
562562
563563 userByUid `shouldMatch` userByIdExtId
564564
565+ -- | Expected SCIM email object. spar synthesizes @type = "work"@ on every stored
566+ -- email (see 'Spar.Scim.User.synthesizeScimUser'), so assertions comparing the
567+ -- server's @emails@ must expect it.
568+ scimWorkEmail :: String -> Value
569+ scimWorkEmail addr = object [" type" .= (" work" :: String ), " value" .= addr]
570+
565571testSparScimTokenLimit :: (HasCallStack ) => App ()
566572testSparScimTokenLimit = withModifiedBackend
567573 def
@@ -1247,7 +1253,7 @@ testScimUpdateEmailAddress (TaggedBool extIdIsEmail) (TaggedBool requireExternal
12471253 res. json %. " id" `shouldMatch` uid
12481254 lookupField res. json " emails"
12491255 `shouldMatch` ( if extIdIsEmail
1250- then Just [object [ " value " .= oldEmail] ]
1256+ then Just [scimWorkEmail oldEmail]
12511257 else Nothing
12521258 )
12531259
@@ -1266,11 +1272,11 @@ testScimUpdateEmailAddress (TaggedBool extIdIsEmail) (TaggedBool requireExternal
12661272
12671273 updateScimUser OwnDomain tok uid newScimUser `bindResponse` \ res -> do
12681274 res. status `shouldMatchInt` 200
1269- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail] ]
1275+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail]
12701276
12711277 getScimUser OwnDomain tok uid `bindResponse` \ res -> do
12721278 res. status `shouldMatchInt` 200
1273- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail] ]
1279+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail]
12741280
12751281 when requireExternalEmailVerification $ do
12761282 getUsersId OwnDomain [uid] `bindResponse` \ res -> do
@@ -1334,7 +1340,7 @@ testScimUpdateEmailAddressAndExternalId = do
13341340 getScimUser OwnDomain tok brigUserId `bindResponse` \ res -> do
13351341 res. status `shouldMatchInt` 200
13361342 res. json %. " id" `shouldMatch` brigUserId
1337- res. json %. " emails" `shouldMatch` [object [ " value " .= extId1] ]
1343+ res. json %. " emails" `shouldMatch` [scimWorkEmail extId1]
13381344
13391345 findUsersByExternalId OwnDomain tok extId1 `bindResponse` \ res -> do
13401346 res. status `shouldMatchInt` 200
@@ -1357,11 +1363,11 @@ testScimUpdateEmailAddressAndExternalId = do
13571363 updateScimUser OwnDomain tok brigUserId newScimUser1 `bindResponse` \ res -> do
13581364 res. status `shouldMatchInt` 200
13591365 res. json %. " externalId" `shouldMatch` extId1
1360- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1366+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
13611367
13621368 getScimUser OwnDomain tok brigUserId `bindResponse` \ res -> do
13631369 res. status `shouldMatchInt` 200
1364- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1370+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
13651371
13661372 findUsersByExternalId OwnDomain tok extId1 `bindResponse` \ res -> do
13671373 res. status `shouldMatchInt` 200
@@ -1390,11 +1396,11 @@ testScimUpdateEmailAddressAndExternalId = do
13901396 updateScimUser OwnDomain tok brigUserId newScimUser2 `bindResponse` \ res -> do
13911397 res. status `shouldMatchInt` 200
13921398 res. json %. " externalId" `shouldMatch` newExtId2
1393- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1399+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
13941400
13951401 getScimUser OwnDomain tok brigUserId `bindResponse` \ res -> do
13961402 res. status `shouldMatchInt` 200
1397- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1403+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
13981404
13991405 findUsersByExternalId OwnDomain tok newExtId2 `bindResponse` \ res -> do
14001406 res. status `shouldMatchInt` 200
@@ -1423,11 +1429,11 @@ testScimUpdateEmailAddressAndExternalId = do
14231429 updateScimUser OwnDomain tok brigUserId newScimUser3 `bindResponse` \ res -> do
14241430 res. status `shouldMatchInt` 200
14251431 res. json %. " externalId" `shouldMatch` newEmail3
1426- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1432+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
14271433
14281434 getScimUser OwnDomain tok brigUserId `bindResponse` \ res -> do
14291435 res. status `shouldMatchInt` 200
1430- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail1] ]
1436+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail1]
14311437
14321438 findUsersByExternalId OwnDomain tok newEmail3 `bindResponse` \ res -> do
14331439 res. status `shouldMatchInt` 200
@@ -1639,7 +1645,7 @@ testAllowUpdatesBySCIMWhenE2EIdEnabled (TaggedBool ssoEnabled) = do
16391645 su <- setField " emails" [object [" value" .= newEmail]] scimUser
16401646 bindResponse (updateScimUser OwnDomain tok uid su) $ \ res -> do
16411647 res. status `shouldMatchInt` 200
1642- res. json %. " emails" `shouldMatch` [object [ " value " .= newEmail] ]
1648+ res. json %. " emails" `shouldMatch` [scimWorkEmail newEmail]
16431649 activateEmail OwnDomain newEmail
16441650 bindResponse (getUsersId OwnDomain [uid]) $ \ res -> do
16451651 res. status `shouldMatchInt` 200
0 commit comments