Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPB-6269 test: team settings and propertied cannot be changed by foreign team owner #3866

Merged
merged 1 commit into from
Feb 1, 2024
Merged
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
30 changes: 20 additions & 10 deletions integration/test/Test/TeamSettings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,38 @@ import Testlib.Prelude

testTeamSettingsUpdate :: HasCallStack => App ()
testTeamSettingsUpdate = do
(owner, tid, [mem]) <- createTeam OwnDomain 2
partner <- createTeamMemberWithRole owner tid "partner"
(ownerA, tidA, [mem]) <- createTeam OwnDomain 2
partner <- createTeamMemberWithRole ownerA tidA "partner"

bindResponse (putAppLockSettings tid owner def) $ \resp -> do
bindResponse (putAppLockSettings tidA ownerA def) $ \resp -> do
resp.status `shouldMatchInt` 200
bindResponse (putAppLockSettings tid mem def) $ \resp -> do
bindResponse (putAppLockSettings tidA mem def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "operation-denied"
bindResponse (putAppLockSettings tid partner def) $ \resp -> do
bindResponse (putAppLockSettings tidA partner def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "operation-denied"

(ownerB, _tidB, []) <- createTeam OwnDomain 1
bindResponse (putAppLockSettings tidA ownerB def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "no-team-member"

testTeamPropertiesUpdate :: HasCallStack => App ()
testTeamPropertiesUpdate = do
(owner, tid, [mem]) <- createTeam OwnDomain 2
partner <- createTeamMemberWithRole owner tid "partner"
(ownerA, tidA, [mem]) <- createTeam OwnDomain 2
partner <- createTeamMemberWithRole ownerA tidA "partner"

bindResponse (putTeamProperties tid owner def) $ \resp -> do
bindResponse (putTeamProperties tidA ownerA def) $ \resp -> do
resp.status `shouldMatchInt` 200
bindResponse (putTeamProperties tid mem def) $ \resp -> do
bindResponse (putTeamProperties tidA mem def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "operation-denied"
bindResponse (putTeamProperties tid partner def) $ \resp -> do
bindResponse (putTeamProperties tidA partner def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "operation-denied"

(ownerB, _tidB, []) <- createTeam OwnDomain 1
bindResponse (putTeamProperties tidA ownerB def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "no-team-member"
Loading