Skip to content

Commit

Permalink
Add backoffice/stern routes.
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Jan 2, 2024
1 parent d7100f3 commit 9ae393d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tools/stern/src/Stern/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ sitemap' =
:<|> Named @"get-route-outlook-cal-config" (mkFeatureGetRoute @OutlookCalIntegrationConfig)
:<|> Named @"lock-unlock-route-outlook-cal-config" (mkFeatureLockUnlockRouteTrivialConfigNoTTL @OutlookCalIntegrationConfig)
:<|> Named @"put-route-outlook-cal-config" (mkFeaturePutRouteTrivialConfigNoTTL @OutlookCalIntegrationConfig)
:<|> Named @"get-route-enforce-file-download-location" (mkFeatureGetRoute @EnforceFileDownloadLocationConfig)
:<|> Named @"put-route-enforce-file-download-location" (mkFeaturePutRoute @EnforceFileDownloadLocationConfig)
:<|> Named @"get-team-invoice" getTeamInvoice
:<|> Named @"get-team-billing-info" getTeamBillingInfo
:<|> Named @"put-team-billing-info" updateTeamBillingInfo
Expand Down
2 changes: 2 additions & 0 deletions tools/stern/src/Stern/API/Routes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ type SternAPI =
:<|> Named "get-route-outlook-cal-config" (MkFeatureGetRoute OutlookCalIntegrationConfig)
:<|> Named "lock-unlock-route-outlook-cal-config" (MkFeatureLockUnlockRouteTrivialConfigNoTTL OutlookCalIntegrationConfig)
:<|> Named "put-route-outlook-cal-config" (MkFeaturePutRouteTrivialConfigNoTTL OutlookCalIntegrationConfig)
:<|> Named "get-route-enforce-file-download-location" (MkFeatureGetRoute EnforceFileDownloadLocationConfig)
:<|> Named "put-route-enforce-file-download-location" (MkFeaturePutRoute EnforceFileDownloadLocationConfig)
:<|> Named
"get-team-invoice"
( Summary "Get a specific invoice by Number"
Expand Down
2 changes: 1 addition & 1 deletion tools/stern/src/Stern/Intra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ setTeamFeatureFlag tid status = do
resp <- catchRpcErrors $ rpc' "galley" gly req
case statusCode resp of
200 -> pure ()
404 -> throwE (mkError status404 "bad-upstream" "team doesnt exist")
404 -> throwE (mkError status404 "bad-upstream" "team does not exist")
403 -> throwE (mkError status403 "bad-upstream" "legal hold config cannot be changed")
_ -> throwE (mkError status502 "bad-upstream" (errorMessage resp))
where
Expand Down
5 changes: 3 additions & 2 deletions tools/stern/test/integration/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ tests s =
test s "GET /teams/:tid/features/classifiedDomains" $ testGetFeatureConfig @ClassifiedDomainsConfig (Just FeatureStatusEnabled),
test s "GET /teams/:tid/features/outlookCalIntegration" $ testFeatureStatus @OutlookCalIntegrationConfig,
test s "PUT /teams/:tid/features/outlookCalIntegration{,'?lockOrUnlock'}" $ testFeatureStatusWithLock @OutlookCalIntegrationConfig,
test s "GET /teams/:tid/features/enforceFileDownloadLocation" $ testFeatureStatus @EnforceFileDownloadLocationConfig,
test s "GET /i/consent" testGetConsentLog,
test s "GET /teams/:id" testGetTeamInfo,
test s "GET i/user/meta-info?id=..." testGetUserMetaInfo,
test s "/teams/:tid/search-visibility" testSearchVisibility,
test s "/sso-domain-redirect" testRudSsoDomainRedirect,
test s "i/oauth/clients" testCrudOAuthClient
-- The following endpoints can not be tested because they require ibis:
-- The following endpoints can not be tested here because they require ibis:
-- - `GET /teams/:tid/billing`
-- - `GET /teams/:tid/invoice/:inr`
-- - `PUT /teams/:tid/billing`
Expand Down Expand Up @@ -334,7 +335,7 @@ testFeatureStatusOptTtl mTtl = do
liftIO $ cfg @?= defFeatureStatus @cfg
when (wsLockStatus cfg == LockStatusLocked) $ unlockFeature @cfg tid
let newStatus = if wsStatus cfg == FeatureStatusEnabled then FeatureStatusDisabled else FeatureStatusEnabled
void $ putFeatureStatus @cfg tid newStatus mTtl
putFeatureStatus @cfg tid newStatus mTtl !!! const 200 === statusCode
cfg' <- getFeatureConfig @cfg tid
liftIO $ wsStatus cfg' @?= newStatus

Expand Down

0 comments on commit 9ae393d

Please sign in to comment.