Skip to content
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
1 change: 1 addition & 0 deletions changelog.d/5-internal/WPB-6442
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port team feature tests to the `integration` package
1 change: 1 addition & 0 deletions integration/integration.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ library
Test.Errors
Test.ExternalPartner
Test.FeatureFlags
Test.FeatureFlags.Util
Test.Federation
Test.Federator
Test.LegalHold
Expand Down
11 changes: 11 additions & 0 deletions integration/test/API/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,14 @@ putLegalholdStatus tid usr status = do
baseRequest usr Galley Versioned (joinHttpPath ["teams", tidStr, "features", "legalhold"])
>>= submit "PUT"
. addJSONObject ["status" .= status, "ttl" .= "unlimited"]

setTeamFeatureConfig :: (HasCallStack, MakesValue user, MakesValue team, MakesValue featureName, MakesValue payload) => user -> team -> featureName -> payload -> App Response
setTeamFeatureConfig = setTeamFeatureConfigVersioned Versioned

setTeamFeatureConfigVersioned :: (HasCallStack, MakesValue user, MakesValue team, MakesValue featureName, MakesValue payload) => Versioned -> user -> team -> featureName -> payload -> App Response
setTeamFeatureConfigVersioned versioned user team featureName payload = do
tid <- asString team
fn <- asString featureName
p <- make payload
req <- baseRequest user Galley versioned $ joinHttpPath ["teams", tid, "features", fn]
submit "PUT" $ req & addJSON p
26 changes: 23 additions & 3 deletions integration/test/API/GalleyInternal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ setTeamFeatureStatus domain team featureName status = do
req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid, "features", featureName]
submit "PATCH" $ req & addJSONObject ["status" .= status]

setTeamFeatureLockStatus :: (HasCallStack, MakesValue domain, MakesValue team) => domain -> team -> String -> String -> App ()
setTeamFeatureLockStatus domain team featureName status = do
tid <- asString team
req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid, "features", featureName, status]
bindResponse (submit "PUT" $ req) $ \res ->
res.status `shouldMatchInt` 200

getFederationStatus ::
( HasCallStack,
MakesValue user
Expand Down Expand Up @@ -72,12 +79,12 @@ legalholdIsTeamInWhitelist tid uid = do
req <- baseRequest uid Galley Unversioned $ joinHttpPath ["i", "legalhold", "whitelisted-teams", tidStr]
submit "GET" req

setTeamFeatureConfig :: (HasCallStack, MakesValue domain, MakesValue team, MakesValue featureName, MakesValue payload) => Versioned -> domain -> team -> featureName -> payload -> App Response
setTeamFeatureConfig versioned domain team featureName payload = do
setTeamFeatureConfig :: (HasCallStack, MakesValue domain, MakesValue team, MakesValue featureName, MakesValue payload) => domain -> team -> featureName -> payload -> App Response
setTeamFeatureConfig domain team featureName payload = do
tid <- asString team
fn <- asString featureName
p <- make payload
req <- baseRequest domain Galley versioned $ joinHttpPath ["teams", tid, "features", fn]
req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid, "features", fn]
submit "PUT" $ req & addJSON p

-- | https://staging-nginz-https.zinfra.io/api-internal/swagger-ui/galley/#/galley/get_i_teams__tid__features_legalhold
Expand All @@ -86,3 +93,16 @@ legalholdIsEnabled tid uid = do
tidStr <- asString tid
baseRequest uid Galley Unversioned do joinHttpPath ["i", "teams", tidStr, "features", "legalhold"]
>>= submit "GET"

-- https://staging-nginz-https.zinfra.io/api-internal/swagger-ui/galley/#/galley/post_i_features_multi_teams_searchVisibilityInbound
getFeatureStatusMulti :: (HasCallStack, MakesValue domain, MakesValue featureName) => domain -> featureName -> [String] -> App Response
getFeatureStatusMulti domain featureName tids = do
fn <- asString featureName
req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "features-multi-teams", fn]
submit "POST" $ req & addJSONObject ["teams" .= tids]

patchTeamFeature :: (HasCallStack, MakesValue domain, MakesValue team) => domain -> team -> String -> Value -> App Response
patchTeamFeature domain team featureName payload = do
tid <- asString team
req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid, "features", featureName]
submit "PATCH" $ req & addJSON payload
4 changes: 4 additions & 0 deletions integration/test/Notifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ isDeleteUserNotif :: MakesValue a => a -> App Bool
isDeleteUserNotif n =
nPayload n %. "type" `isEqual` "user.delete"

isFeatureConfigUpdateNotif :: MakesValue a => a -> App Bool
isFeatureConfigUpdateNotif n =
nPayload n %. "type" `isEqual` "feature-config.update"

isNewMessageNotif :: MakesValue a => a -> App Bool
isNewMessageNotif n = fieldEquals n "payload.0.type" "conversation.otr-message-add"

Expand Down
Loading