From 3cc4ed54d203b8bebb679150d3d8b9bb91122bf8 Mon Sep 17 00:00:00 2001 From: Magnus Viernickel Date: Mon, 24 Jun 2024 11:39:41 +0200 Subject: [PATCH] [chore] add test that confirms behaviour of LH from the issue --- integration/test/Test/LegalHold.hs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/integration/test/Test/LegalHold.hs b/integration/test/Test/LegalHold.hs index 86373c28cb0..d8c1a5fe9d4 100644 --- a/integration/test/Test/LegalHold.hs +++ b/integration/test/Test/LegalHold.hs @@ -873,8 +873,8 @@ testLHCannotCreateGroupWithUsersInConflict = do postConversation bob defProteus {qualifiedUsers = [debora, alice], newUsersRole = "wire_member", team = Just tidAlice} >>= assertLabel 403 "missing-legalhold-consent" -testNoConsentCannotBeInvited :: (HasCallStack) => App () -testNoConsentCannotBeInvited = do +testLHNoConsentCannotBeInvited :: (HasCallStack) => App () +testLHNoConsentCannotBeInvited = do -- team that is legalhold whitelisted (legalholder, tidLH, userLHNotActivated : _) <- createTeam OwnDomain 2 legalholdWhitelistTeam tidLH legalholder >>= assertStatus 200 @@ -904,3 +904,22 @@ testNoConsentCannotBeInvited = do resp.json %. "status" `shouldMatch` "enabled" addMembers userLHNotActivated cid (def {users = [peer3]}) >>= assertLabel 403 "not-connected" + +testLHRequestDeletionHasUserEffect :: (HasCallStack) => App () +testLHRequestDeletionHasUserEffect = do + (alice, tid, [bob]) <- createTeam OwnDomain 2 + legalholdWhitelistTeam tid alice >>= assertStatus 200 + + withMockServer def lhMockApp \lhDomAndPort _chan -> do + postLegalHoldSettings tid alice (mkLegalHoldSettings lhDomAndPort) >>= assertStatus 201 + + -- alice requests a legalhold device for bob and sets his status to "pending" + requestLegalHoldDevice tid alice bob >>= assertSuccess + let getBob'sStatus = (getUser bob bob >>= getJSON 200) %. "legalhold_status" & asString + getBob'sStatus `shouldMatch` "pending" + + -- alice disables legalhold. the status for bob should now not be pending anymore + requestLegalHoldDevice tid alice bob >>= assertSuccess + disableLegalHold tid alice bob defPassword + >>= assertStatus 200 + getBob'sStatus `shouldMatch` "disabled"