diff --git a/services/spar/test-integration/Test/Spar/APISpec.hs b/services/spar/test-integration/Test/Spar/APISpec.hs index e5b0269a3c..7269676e3d 100644 --- a/services/spar/test-integration/Test/Spar/APISpec.hs +++ b/services/spar/test-integration/Test/Spar/APISpec.hs @@ -1013,7 +1013,7 @@ specCRUDIdentityProvider = do idp2 ^. idpMetadata . SAML.edIssuer `shouldBe` issuer2 idp2 ^. idpId `shouldNotBe` idp1 ^. idpId idp2 ^. idpExtraInfo . wiOldIssuers `shouldBe` [idpmeta1 ^. edIssuer] - idp1' ^. idpExtraInfo . wiReplacedBy `shouldBe` (Just $ idp2 ^. idpId) + idp1' ^. idpExtraInfo . wiReplacedBy `shouldBe` Just (idp2 ^. idpId) -- erase everything that is supposed to be different between idp1, idp2, and make -- sure the result is equal. let erase :: IdP -> IdP @@ -1088,7 +1088,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do uid <- getUserIdViaRef' uref liftIO $ do uid `shouldSatisfy` isJust - uref `shouldBe` (SAML.UserRef issuer1 userSubject) + uref `shouldBe` SAML.UserRef issuer1 userSubject idp2 <- let idpmeta2 = idpmeta1 & edIssuer .~ issuer2 in call $ callIdpCreateReplace (env ^. teWireIdPAPIVersion) (env ^. teSpar) (Just owner1) idpmeta2 (idp1 ^. SAML.idpId) @@ -1097,7 +1097,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do uid' <- getUserIdViaRef' uref' liftIO $ do uid' `shouldBe` uid - uref' `shouldBe` (SAML.UserRef issuer1 userSubject) + uref' `shouldBe` SAML.UserRef issuer1 userSubject it "deleting the replacing idp2 before it has users does not block registrations on idp1" $ do env <- ask (owner1, _, idp1, (IdPMetadataValue _ idpmeta1, privkey1)) <- registerTestIdPWithMeta @@ -1112,7 +1112,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do uid <- getUserIdViaRef' uref liftIO $ do uid `shouldSatisfy` isJust - uref `shouldBe` (SAML.UserRef issuer1 userSubject) + uref `shouldBe` SAML.UserRef issuer1 userSubject it "create user1 via idp1 (saml); delete user1; create user via newly created idp2 (saml)" $ do pending it "create user1 via saml; delete user1; create via scim (in same team)" $ do @@ -1134,7 +1134,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do let uref = SAML.UserRef tenant subj subj = either (error . show) id $ SAML.mkNameID uname Nothing Nothing Nothing tenant = idp ^. SAML.idpMetadata . SAML.edIssuer - !(Just !uid) <- createViaSaml idp privcreds uref + (Just !uid) <- createViaSaml idp privcreds uref samlUserShouldSatisfy uref isJust deleteViaBrig uid samlUserShouldSatisfy uref isJust -- brig doesn't talk to spar right now when users @@ -1298,10 +1298,9 @@ specSsoSettings = do -- check it is set callGetDefaultSsoCode (env ^. teSpar) `shouldRespondWith` \resp -> - and - [ statusCode resp == 200, - responseJsonEither resp == Right (ssoSettings (Just idpid1)) - ] + (statusCode resp == 200) + && ( responseJsonEither resp == Right (ssoSettings (Just idpid1)) + ) -- update to 2 callSetDefaultSsoCode (env ^. teSpar) idpid2 `shouldRespondWith` \resp -> @@ -1309,10 +1308,9 @@ specSsoSettings = do -- check it is set callGetDefaultSsoCode (env ^. teSpar) `shouldRespondWith` \resp -> - and - [ statusCode resp == 200, - responseJsonEither resp == Right (ssoSettings (Just idpid2)) - ] + (statusCode resp == 200) + && ( responseJsonEither resp == Right (ssoSettings (Just idpid2)) + ) it "allows removing the default SSO code" $ do env <- ask (_userid, _teamid, (^. idpId) -> idpid) <- registerTestIdP @@ -1327,10 +1325,9 @@ specSsoSettings = do -- check it is not set anymore callGetDefaultSsoCode (env ^. teSpar) `shouldRespondWith` \resp -> - and - [ statusCode resp == 200, - responseJsonEither resp == Right (ssoSettings Nothing) - ] + (statusCode resp == 200) + && ( responseJsonEither resp == Right (ssoSettings Nothing) + ) it "removes the default SSO code if the IdP gets removed" $ do env <- ask (userid, _teamid, (^. idpId) -> idpid) <- registerTestIdP @@ -1344,10 +1341,9 @@ specSsoSettings = do -- check it is not set anymore callGetDefaultSsoCode (env ^. teSpar) `shouldRespondWith` \resp -> - and - [ statusCode resp == 200, - responseJsonEither resp == Right (ssoSettings Nothing) - ] + (statusCode resp == 200) + && ( responseJsonEither resp == Right (ssoSettings Nothing) + ) where ssoSettings maybeCode = object diff --git a/services/spar/test-integration/Test/Spar/AppSpec.hs b/services/spar/test-integration/Test/Spar/AppSpec.hs index 0b96fff111..9b06e7dc12 100644 --- a/services/spar/test-integration/Test/Spar/AppSpec.hs +++ b/services/spar/test-integration/Test/Spar/AppSpec.hs @@ -87,7 +87,7 @@ spec = describe "accessVerdict" $ do Servant.errHTTPCode outcome `shouldBe` 303 Servant.errReasonPhrase outcome `shouldBe` "forbidden" Servant.errBody outcome `shouldBe` "[\"No Bearer SubjectConfirmation\",\"no AuthnStatement\"]" - uriScheme loc `shouldBe` (URI.Scheme "wire") + uriScheme loc `shouldBe` URI.Scheme "wire" List.lookup "userid" qry `shouldBe` Nothing List.lookup "cookie" qry `shouldBe` Nothing List.lookup "label" qry `shouldBe` Just "forbidden" @@ -99,7 +99,7 @@ spec = describe "accessVerdict" $ do Servant.errHTTPCode outcome `shouldBe` 303 Servant.errReasonPhrase outcome `shouldBe` "success" Servant.errBody outcome `shouldBe` mempty - uriScheme loc `shouldBe` (URI.Scheme "wire") + uriScheme loc `shouldBe` URI.Scheme "wire" List.lookup "label" qry `shouldBe` Nothing List.lookup "userid" qry `shouldBe` (Just . cs . show $ uid) List.lookup "cookie" qry `shouldNotBe` Nothing diff --git a/services/spar/test-integration/Test/Spar/DataSpec.hs b/services/spar/test-integration/Test/Spar/DataSpec.hs index 0574ef6ef5..ecd5839492 100644 --- a/services/spar/test-integration/Test/Spar/DataSpec.hs +++ b/services/spar/test-integration/Test/Spar/DataSpec.hs @@ -163,14 +163,14 @@ spec = do it "getIdPConfigsByTeam works" $ do skipIdPAPIVersions [WireIdPAPIV1] teamid <- nextWireId - idp <- makeTestIdP <&> idpExtraInfo .~ (WireIdP teamid Nothing [] Nothing) + idp <- makeTestIdP <&> idpExtraInfo .~ WireIdP teamid Nothing [] Nothing () <- runSpar $ IdPEffect.storeConfig idp idps <- runSpar $ IdPEffect.getConfigsByTeam teamid liftIO $ idps `shouldBe` [idp] it "deleteIdPConfig works" $ do teamid <- nextWireId idpApiVersion <- asks (^. teWireIdPAPIVersion) - idp <- makeTestIdP <&> idpExtraInfo .~ (WireIdP teamid (Just idpApiVersion) [] Nothing) + idp <- makeTestIdP <&> idpExtraInfo .~ WireIdP teamid (Just idpApiVersion) [] Nothing () <- runSpar $ IdPEffect.storeConfig idp do midp <- runSpar $ IdPEffect.getConfig (idp ^. idpId) diff --git a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs index 7ed60c2888..a19104a642 100644 --- a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs +++ b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs @@ -135,7 +135,7 @@ specImportToScimFromSAML = let uref = SAML.UserRef tenant subj subj = emailToSAMLNameID email tenant = idp ^. SAML.idpMetadata . SAML.edIssuer - !(Just !uid) <- createViaSaml idp privCreds uref + (Just !uid) <- createViaSaml idp privCreds uref samlUserShouldSatisfy uref isJust pure (uref, uid) @@ -193,7 +193,7 @@ specImportToScimFromSAML = assertBrigCassandra uid uref (Scim.value . Scim.thing $ storedUserUpdated) (valemail, True) ManagedByScim -- login again - !(Just !uid') <- createViaSaml idp privCreds uref + (Just !uid') <- createViaSaml idp privCreds uref liftIO $ uid' `shouldBe` uid specImportToScimFromInvitation :: SpecWith TestEnv @@ -213,7 +213,7 @@ specImportToScimFromInvitation = email <- randomEmail memberInvited <- call (inviteAndRegisterUser (env ^. teBrig) owner teamid email) let memberIdInvited = userId memberInvited - emailInvited = maybe (error "must have email") id (userEmail memberInvited) + emailInvited = fromMaybe (error "must have email") (userEmail memberInvited) pure (memberIdInvited, emailInvited) addSamlIdP :: HasCallStack => UserId -> TestSpar (SAML.IdPConfig User.WireIdP, SAML.SignPrivCreds) @@ -507,7 +507,7 @@ testCsvData tid owner uid mbeid mbsaml hasissuer = do pure (decodeCSV @CsvExport.TeamExportUser rbody) liftIO $ do - any (== uid) (CsvExport.tExportUserId <$> usersInCsv) `shouldBe` True + elem uid (CsvExport.tExportUserId <$> usersInCsv) `shouldBe` True forM_ usersInCsv $ \export -> when (CsvExport.tExportUserId export == uid) $ do ('e', CsvExport.tExportSCIMExternalId export) `shouldBe` ('e', fromMaybe "" mbeid) @@ -924,7 +924,7 @@ testScimCreateVsUserRef = do let uref = SAML.UserRef tenant subj subj = either (error . show) id $ SAML.mkNameID uname Nothing Nothing Nothing tenant = idp ^. SAML.idpMetadata . SAML.edIssuer - !(Just !uid) <- createViaSaml idp privCreds uref + (Just !uid) <- createViaSaml idp privCreds uref samlUserShouldSatisfy uref isJust deleteViaBrig uid samlUserShouldSatisfy uref isJust -- brig doesn't talk to spar right now when users @@ -1138,7 +1138,7 @@ testFindTeamSettingsInvitedUserMigratedWithEmailInTeamWithSSOViaUserId = do let memberIdInvited = userId memberInvited _ <- getUser tok memberIdInvited - Just brigUserInvited' <- runSpar $ Intra.getBrigUser Intra.NoPendingInvitations (memberIdInvited) + Just brigUserInvited' <- runSpar $ Intra.getBrigUser Intra.NoPendingInvitations memberIdInvited liftIO $ userManagedBy brigUserInvited' `shouldBe` ManagedByScim testFindProvisionedUserNoIdP :: TestSpar () @@ -2116,7 +2116,7 @@ specSCIMManaged = do randomAlphaNum :: MonadIO m => m Text randomAlphaNum = liftIO $ do nrs <- replicateM 21 (randomRIO (97, 122)) -- a-z - return (cs (map chr nrs)) + pure (cs (map chr nrs)) ---------------------------------------------------------------------------- -- Team Search for SAML users diff --git a/services/spar/test-integration/Util/Core.hs b/services/spar/test-integration/Util/Core.hs index f967d3674a..22cf0eae3f 100644 --- a/services/spar/test-integration/Util/Core.hs +++ b/services/spar/test-integration/Util/Core.hs @@ -222,20 +222,20 @@ mkEnvFromOptions = do cliOptsParser :: OPA.Parser (String, String) cliOptsParser = (,) - <$> ( OPA.strOption $ - OPA.long "integration-config" - <> OPA.short 'i' - <> OPA.help "Integration config to load" - <> OPA.showDefault - <> OPA.value defaultIntPath - ) - <*> ( OPA.strOption $ - OPA.long "service-config" - <> OPA.short 's' - <> OPA.help "Spar application config to load" - <> OPA.showDefault - <> OPA.value defaultSparPath - ) + <$> OPA.strOption + ( OPA.long "integration-config" + <> OPA.short 'i' + <> OPA.help "Integration config to load" + <> OPA.showDefault + <> OPA.value defaultIntPath + ) + <*> OPA.strOption + ( OPA.long "service-config" + <> OPA.short 's' + <> OPA.help "Spar application config to load" + <> OPA.showDefault + <> OPA.value defaultSparPath + ) where defaultIntPath = "/etc/wire/integration/integration.yaml" defaultSparPath = "/etc/wire/spar/conf/spar.yaml" @@ -333,7 +333,7 @@ getUserBrig uid = do 200 -> do let user = selfUser $ responseJsonUnsafe resp pure $ - if (userDeleted user) + if userDeleted user then Nothing else Just user 404 -> pure Nothing @@ -367,7 +367,7 @@ createUserWithTeamDisableSSO brg gly = do () <- Control.Exception.assert {- "Team ID in self profile and team table do not match" -} (selfTeam == Just tid) $ pure () - return (uid, tid) + pure (uid, tid) getSSOEnabledInternal :: (HasCallStack, MonadHttp m, MonadIO m) => GalleyReq -> TeamId -> m ResponseLBS getSSOEnabledInternal gly tid = do @@ -407,7 +407,7 @@ inviteAndRegisterUser brig u tid inviteeEmail = do unless (Just tid == userTeam invitee) $ error "Team ID in registration and team table do not match" selfTeam <- userTeam . selfUser <$> getSelfProfile brig (userId invitee) unless (selfTeam == Just tid) $ error "Team ID in self profile and team table do not match" - return invitee + pure invitee where accept' :: User.Email -> User.InvitationCode -> RequestBody accept' email code = acceptWithName (User.Name "Bob") email code @@ -450,7 +450,7 @@ inviteAndRegisterUser brig u tid inviteeEmail = do . queryItem "invitation_id" (toByteString' ref) ) let lbs = fromMaybe "" $ responseBody r - return $ fromByteString . fromMaybe (error "No code?") $ encodeUtf8 <$> (lbs ^? key "code" . _String) + pure $ fromByteString (maybe (error "No code?") encodeUtf8 (lbs ^? key "code" . _String)) -- | NB: this does create an SSO UserRef on brig, but not on spar. this is inconsistent, but the -- inconsistency does not affect the tests we're running with this. to resolve it, we could add an @@ -550,11 +550,9 @@ nextSubject = liftIO $ do nextUserRef :: MonadIO m => m SAML.UserRef nextUserRef = liftIO $ do tenant <- UUID.toText <$> UUID.nextRandom - subject <- nextSubject - pure $ - SAML.UserRef - (SAML.Issuer $ SAML.unsafeParseURI ("http://" <> tenant)) - subject + SAML.UserRef + (SAML.Issuer $ SAML.unsafeParseURI ("http://" <> tenant)) + <$> nextSubject createRandomPhoneUser :: (HasCallStack, MonadCatch m, MonadIO m, MonadHttp m) => BrigReq -> m (UserId, Brig.Phone) createRandomPhoneUser brig_ = do @@ -574,7 +572,7 @@ createRandomPhoneUser brig_ = do get (brig_ . path "/self" . zUser uid) !!! do const 200 === statusCode const (Right (Just phn)) === (fmap Brig.userPhone . responseJsonEither) - return (uid, phn) + pure (uid, phn) getTeams :: (HasCallStack, MonadHttp m, MonadIO m) => UserId -> GalleyReq -> m Galley.TeamList getTeams u gly = do @@ -585,7 +583,7 @@ getTeams u gly = do . zAuthAccess u "conn" . expect2xx ) - return $ responseJsonUnsafe r + pure $ responseJsonUnsafe r getTeamMemberIds :: HasCallStack => UserId -> TeamId -> TestSpar [UserId] getTeamMemberIds usr tid = (^. Galley.userId) <$$> getTeamMembers usr tid @@ -613,7 +611,7 @@ promoteTeamMember usr tid memid = do getSelfProfile :: (HasCallStack, MonadHttp m, MonadIO m) => BrigReq -> UserId -> m Brig.SelfProfile getSelfProfile brg usr = do rsp <- get $ brg . path "/self" . zUser usr - return $ responseJsonUnsafe rsp + pure $ responseJsonUnsafe rsp zAuthAccess :: UserId -> SBS -> Request -> Request zAuthAccess u c = header "Z-Type" "access" . zUser u . zConn c @@ -624,13 +622,13 @@ newTeam = Galley.BindingNewTeam $ Galley.newNewTeam (unsafeRange "teamName") Def randomEmail :: MonadIO m => m Brig.Email randomEmail = do uid <- liftIO nextRandom - return $ Brig.Email ("success+" <> UUID.toText uid) "simulator.amazonses.com" + pure $ Brig.Email ("success+" <> UUID.toText uid) "simulator.amazonses.com" randomPhone :: MonadIO m => m Brig.Phone randomPhone = liftIO $ do nrs <- map show <$> replicateM 14 (randomRIO (0, 9) :: IO Int) let phone = Brig.parsePhone . cs $ "+0" ++ concat nrs - return $ fromMaybe (error "Invalid random phone#") phone + pure $ fromMaybe (error "Invalid random phone#") phone randomUser :: (HasCallStack, MonadCatch m, MonadIO m, MonadHttp m) => BrigReq -> m Brig.User randomUser brig_ = do @@ -644,7 +642,7 @@ createUser :: m Brig.User createUser name brig_ = do r <- postUser name True Nothing Nothing brig_ (lbs ^? Aeson.key "key" . Aeson._String) let acode = Brig.ActivationCode . Ascii.unsafeFromText <$> (lbs ^? Aeson.key "code" . Aeson._String) - return $ (,) <$> akey <*> acode + pure $ (,) <$> akey <*> acode activate :: (HasCallStack, MonadIO m, MonadHttp m) => @@ -753,7 +751,7 @@ makeTestIdP = do SampleIdP md _ _ _ <- makeSampleIdPMetadata IdPConfig <$> (IdPId <$> liftIO UUID.nextRandom) - <*> (pure md) + <*> pure md <*> nextWireIdP apiversion getTestSPMetadata :: (HasCallStack, MonadReader TestEnv m, MonadIO m) => TeamId -> m SPMetadata @@ -932,7 +930,7 @@ loginCreatedSsoUser nameid idp privCreds = do authnResp <- runSimpleSP $ mkAuthnResponseWithSubj nameid privCreds idp spmeta authnReq True sparAuthnResp <- submitAuthnResponse tid authnResp - let wireCookie = maybe (error (show sparAuthnResp)) id . lookup "Set-Cookie" $ responseHeaders sparAuthnResp + let wireCookie = fromMaybe (error (show sparAuthnResp)) . lookup "Set-Cookie" $ responseHeaders sparAuthnResp accessResp :: ResponseLBS <- call $ post ((env ^. teBrig) . path "/access" . header "Cookie" wireCookie . expect2xx) @@ -1095,16 +1093,15 @@ callIdpCreateReplace' apiversion sparreq_ muid metadata idpid = do . maybe id zUser muid . path "/identity-providers/" . Bilge.query - ( [ ( "api_version", - case apiversion of - WireIdPAPIV1 -> if explicitQueryParam then Just "v1" else Nothing - WireIdPAPIV2 -> Just "v2" - ), - ( "replaces", - Just . cs . idPIdToST $ idpid - ) - ] - ) + [ ( "api_version", + case apiversion of + WireIdPAPIV1 -> if explicitQueryParam then Just "v1" else Nothing + WireIdPAPIV2 -> Just "v2" + ), + ( "replaces", + Just . cs . idPIdToST $ idpid + ) + ] . body (RequestBodyLBS . cs $ SAML.encode metadata) . header "Content-Type" "application/xml" diff --git a/services/spar/test-integration/Util/Email.hs b/services/spar/test-integration/Util/Email.hs index f3ebef1b10..6f503cb5e0 100644 --- a/services/spar/test-integration/Util/Email.hs +++ b/services/spar/test-integration/Util/Email.hs @@ -153,7 +153,7 @@ getActivationCode brig ep = do let lbs = fromMaybe "" $ responseBody r let akey = ActivationKey . Ascii.unsafeFromText <$> (lbs ^? key "key" . _String) let acode = ActivationCode . Ascii.unsafeFromText <$> (lbs ^? key "code" . _String) - return $ (,) <$> akey <*> acode + pure $ (,) <$> akey <*> acode setSamlEmailValidation :: HasCallStack => TeamId -> Feature.TeamFeatureStatusValue -> TestSpar () setSamlEmailValidation tid status = do diff --git a/services/spar/test-integration/Util/Invitation.hs b/services/spar/test-integration/Util/Invitation.hs index bbd69b67bb..5d1a4f88d3 100644 --- a/services/spar/test-integration/Util/Invitation.hs +++ b/services/spar/test-integration/Util/Invitation.hs @@ -66,7 +66,7 @@ getInvitationCode brig t ref = do . queryItem "invitation_id" (toByteString' ref) ) let lbs = fromMaybe "" $ responseBody r - return $ fromByteString . fromMaybe (error "No code?") $ encodeUtf8 <$> (lbs ^? key "code" . _String) + pure $ fromByteString (maybe (error "No code?") encodeUtf8 (lbs ^? key "code" . _String)) registerInvitation :: HasCallStack => Email -> Name -> InvitationCode -> Bool -> TestSpar () registerInvitation email name inviteeCode shouldSucceed = do diff --git a/services/spar/test-integration/Util/Scim.hs b/services/spar/test-integration/Util/Scim.hs index b74a9406ac..4ac23e3b22 100644 --- a/services/spar/test-integration/Util/Scim.hs +++ b/services/spar/test-integration/Util/Scim.hs @@ -249,7 +249,7 @@ listUsers :: HasCallStack => ScimToken -> Maybe Scim.Filter -> - TestSpar [(Scim.StoredUser SparTag)] + TestSpar [Scim.StoredUser SparTag] listUsers tok mbFilter = do env <- ask r <- diff --git a/services/spar/test/Test/Spar/APISpec.hs b/services/spar/test/Test/Spar/APISpec.hs index 807878f5d5..814eb2e681 100644 --- a/services/spar/test/Test/Spar/APISpec.hs +++ b/services/spar/test/Test/Spar/APISpec.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} - -- This file is part of the Wire Server implementation. -- -- Copyright (C) 2022 Wire Swiss GmbH diff --git a/services/spar/test/Test/Spar/DataSpec.hs b/services/spar/test/Test/Spar/DataSpec.hs index 45b73dc67c..32ece91eab 100644 --- a/services/spar/test/Test/Spar/DataSpec.hs +++ b/services/spar/test/Test/Spar/DataSpec.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} - -- This file is part of the Wire Server implementation. -- -- Copyright (C) 2022 Wire Swiss GmbH @@ -36,13 +34,13 @@ spec = do describe "ttlToNominalDiffTime" $ do it "" $ do addTime (ttlToNominalDiffTime $ TTL 3) (Time $ parsetm "1924-07-14T08:30:00Z") - `shouldBe` (Time $ parsetm "1924-07-14T08:30:03Z") + `shouldBe` Time (parsetm "1924-07-14T08:30:03Z") check :: HasCallStack => Int -> Env -> String -> Either TTLError (TTL "authresp") -> Spec check testnumber env (parsetm -> endOfLife) expectttl = it (show testnumber) $ mkTTLAssertions env endOfLife `shouldBe` expectttl -mkDataEnv :: HasCallStack => String -> (TTL "authresp") -> Env +mkDataEnv :: HasCallStack => String -> TTL "authresp" -> Env mkDataEnv now maxttl = Env (parsetm now) diff --git a/services/spar/test/Test/Spar/Intra/BrigSpec.hs b/services/spar/test/Test/Spar/Intra/BrigSpec.hs index ee7c29934b..940d1de564 100644 --- a/services/spar/test/Test/Spar/Intra/BrigSpec.hs +++ b/services/spar/test/Test/Spar/Intra/BrigSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} -- This file is part of the Wire Server implementation. diff --git a/services/spar/test/Test/Spar/ScimSpec.hs b/services/spar/test/Test/Spar/ScimSpec.hs index 8dddea10dd..f2d6ecdcfe 100644 --- a/services/spar/test/Test/Spar/ScimSpec.hs +++ b/services/spar/test/Test/Spar/ScimSpec.hs @@ -137,7 +137,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra mempty) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "newAttr" "newValue"])))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "newAttr" "newValue"]))) it "can replace in rich info map" $ do let operationJSON = [aesonQQ|{ @@ -150,7 +150,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue"]))) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "newValue"])))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "newValue"]))) it "treats rich info map case insensitively" $ do let operationJSON = [aesonQQ|{ @@ -163,7 +163,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue"]))) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "newValue"])))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "newValue"]))) it "can remove from rich info map" $ do let operationJSON = [aesonQQ|{ @@ -175,7 +175,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue"]))) operation - `shouldBe` (Right (ScimUserExtra mempty)) + `shouldBe` Right (ScimUserExtra mempty) it "adds new fields to rich info assoc list at the end" $ do let operationJSON = [aesonQQ|{ @@ -188,7 +188,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue"]))) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue", RichField "newAttr" "newValue"])))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue", RichField "newAttr" "newValue"]))) it "can replace in rich info assoc list while maintaining order" $ do let operationJSON = [aesonQQ|{ @@ -211,7 +211,7 @@ spec = describe "toScimStoredUser'" $ do RichField "thirdAttr" "thirdVal" ] applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList origAssocList))) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList expectedAssocList)))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList expectedAssocList))) it "can remove from rich info assoc list" $ do let operationJSON = [aesonQQ|{ @@ -223,7 +223,7 @@ spec = describe "toScimStoredUser'" $ do }|] let (Aeson.Success (PatchOp [operation])) = Aeson.parse (parseJSON @(PatchOp SparTag)) operationJSON applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList [RichField "oldAttr" "oldValue"]))) operation - `shouldBe` (Right (ScimUserExtra mempty)) + `shouldBe` Right (ScimUserExtra mempty) it "throws error if asked to patch an recognized schema" $ do let schema = Just (CustomSchema "wrong-schema") path = Just (NormalPath (AttrPath schema "oldAttr" Nothing)) @@ -252,7 +252,7 @@ spec = describe "toScimStoredUser'" $ do RichField "thirdAttr" "thirdVal" ] applyOperation (ScimUserExtra (RichInfo (mkRichInfoAssocList origAssocList))) operation - `shouldBe` (Right (ScimUserExtra (RichInfo (mkRichInfoAssocList expectedAssocList)))) + `shouldBe` Right (ScimUserExtra (RichInfo (mkRichInfoAssocList expectedAssocList))) describe "normalization" $ do let usr :: User SparTag diff --git a/services/spar/test/Test/Spar/Sem/IdPConfigStoreSpec.hs b/services/spar/test/Test/Spar/Sem/IdPConfigStoreSpec.hs index 961f27773f..af387bd5fe 100644 --- a/services/spar/test/Test/Spar/Sem/IdPConfigStoreSpec.hs +++ b/services/spar/test/Test/Spar/Sem/IdPConfigStoreSpec.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE QuantifiedConstraints #-} -{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}