Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions integration/test/Test/TeamCollaborators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Test.TeamCollaborators where

import API.Brig
import API.Galley
import qualified API.GalleyInternal as Internal
import Data.Tuple.Extra
import Notifications (isTeamCollaboratorAddedNotif)
import SetupHelpers
Expand Down Expand Up @@ -96,6 +97,31 @@ testCollaboratorCanCreateTeamConv (TaggedBool collaboratorHasTeam) = do
resp.status `shouldMatchInt` 201
resp.json %. "team" `shouldMatch` team

testCollaboratorCanBeAddedToTeamConversation :: (HasCallStack) => App ()
testCollaboratorCanBeAddedToTeamConversation = do
(owner, team, [alice]) <- createTeam OwnDomain 2

bob <- randomUser OwnDomain def
addTeamCollaborator owner team bob ["implicit_connection"] >>= assertSuccess

putStrLn "================= Test"
conv <-
postConversation
owner
defProteus {team = Just team, qualifiedUsers = [alice, bob]}
>>= getJSON 201

getConversation alice conv `bindResponse` \resp -> do
resp.status `shouldMatchInt` 200

getConversation bob conv `bindResponse` \resp -> do
resp.status `shouldMatchInt` 200

Internal.getConversation conv `bindResponse` \resp -> do
resp.status `shouldMatchInt` 200
convMems <- resp.json %. "members.others" & asList
for [alice, bob] (\m -> m %. "id") `shouldMatchSet` (for convMems (\m -> m %. "id"))

testImplicitConnectionAllowed :: (HasCallStack) => App ()
testImplicitConnectionAllowed = do
(owner, team, [alice]) <- createTeam OwnDomain 2
Expand Down