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 add test for team properties auth #3862

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions integration/test/API/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,37 @@ putAppLockSettings tid caller settings = do
req
)

data TeamProperties = TeamProperties
{ icon :: String,
iconKey :: String,
name :: String,
spashScreen :: String
}

instance Default TeamProperties where
def = TeamProperties "default" "default" "test" "default"

-- | https://staging-nginz-https.zinfra.io/v6/api/swagger-ui/#/default/put_teams__tid_
putTeamProperties ::
(HasCallStack, MakesValue tid, MakesValue caller) =>
tid ->
caller ->
TeamProperties ->
App Response
putTeamProperties tid caller properties = do
tidStr <- asString tid
req <- baseRequest caller Galley Versioned (joinHttpPath ["teams", tidStr])
submit
"PUT"
( addJSONObject
[ "icon" .= properties.icon,
"icon_key" .= properties.iconKey,
"name" .= properties.name,
"splash_screen" .= properties.spashScreen
]
req
)

-- | https://staging-nginz-https.zinfra.io/v5/api/swagger-ui/#/default/post_teams__tid__legalhold_settings
enableLegalHold :: (HasCallStack, MakesValue tid, MakesValue ownerid) => tid -> ownerid -> App Response
enableLegalHold tid ownerid = do
Expand Down
14 changes: 14 additions & 0 deletions integration/test/Test/TeamSettings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ testTeamSettingsUpdate = do
bindResponse (putAppLockSettings tid partner def) $ \resp -> do
resp.status `shouldMatchInt` 403
resp.json %. "label" `shouldMatch` "operation-denied"

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

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