Skip to content

Commit

Permalink
Test: Migrate "Remote connections: send then cancel"
Browse files Browse the repository at this point in the history
  • Loading branch information
mdimjasevic committed Dec 13, 2023
1 parent 55f405b commit a1225f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 10 additions & 0 deletions integration/test/Test/Connection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,13 @@ testSentFromBlocked = do
-- transitions to "sent"
void $ putConnection alice bob "accepted" >>= getBody 200
assertConnectionStatus alice bob "sent"

testCancel :: HasCallStack => App ()
testCancel = do
[alice, bob] <- forM [OwnDomain, OtherDomain] $ flip randomUser def

void $ postConnection alice bob >>= getBody 201
assertConnectionStatus alice bob "sent"

void $ putConnection alice bob "cancelled" >>= getBody 200
assertConnectionStatus alice bob "cancelled"
8 changes: 0 additions & 8 deletions services/brig/test/integration/API/User/Connection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ tests cl _at opts p b _c g fedBrigClient _fedGalleyClient db =
test p "Remote connections: connect with Anon" (testConnectWithAnon b fedBrigClient),
test p "Remote connections: connection from Anon" (testConnectFromAnon b),
test p "Remote connections: connect twice" (testConnectFromPending b fedBrigClient),
test p "Remote connections: send then cancel" (testCancel opts b),
test p "Remote connections: limits" (testConnectionLimits opts b fedBrigClient),
test p "post /users/connections-status/v2 : All connections" (testInternalGetConnStatusesAll b opts fedBrigClient)
]
Expand Down Expand Up @@ -750,13 +749,6 @@ testConnectFromPending brig fedBrigClient = do
receiveConnectionAction brig fedBrigClient uid1 quid2 RemoteConnect Nothing Pending
receiveConnectionAction brig fedBrigClient uid1 quid2 RemoteRescind Nothing Cancelled

testCancel :: Opt.Opts -> Brig -> Http ()
testCancel opts brig = do
(uid1, quid2) <- localAndRemoteUser brig

sendConnectionAction brig opts uid1 quid2 Nothing Sent
sendConnectionUpdateAction brig opts uid1 quid2 Nothing Cancelled

testConnectionLimits :: Opt.Opts -> Brig -> FedClient 'Brig -> Http ()
testConnectionLimits opts brig fedBrigClient = do
let connectionLimit = Opt.setUserMaxConnections (Opt.optSettings opts)
Expand Down

0 comments on commit a1225f5

Please sign in to comment.