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/pr-3232
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
More backoffice/stern integration tests and fixes
3 changes: 2 additions & 1 deletion tools/stern/src/Stern/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import Stern.Types
import System.Logger.Class hiding (Error, name, trace, (.=))
import Util.Options
import Wire.API.Connection
import Wire.API.Internal.Notification (QueuedNotification)
import Wire.API.Routes.Internal.Brig.Connection (ConnectionStatus)
import qualified Wire.API.Routes.Internal.Brig.EJPD as EJPD
import qualified Wire.API.Routes.Internal.Galley.TeamsIntra as Team
Expand Down Expand Up @@ -397,7 +398,7 @@ getUserData uid = do
conns <- Intra.getUserConnections uid
convs <- Intra.getUserConversations uid
clts <- Intra.getUserClients uid
notfs <- Intra.getUserNotifications uid
notfs <- (Intra.getUserNotifications uid <&> toJSON @[QueuedNotification]) `catchE` (pure . String . cs . show)
consent <- (Intra.getUserConsentValue uid <&> toJSON @ConsentValue) `catchE` (pure . String . cs . show)
consentLog <- (Intra.getUserConsentLog uid <&> toJSON @ConsentLog) `catchE` (pure . String . cs . show)
cookies <- Intra.getUserCookies uid
Expand Down
15 changes: 8 additions & 7 deletions tools/stern/src/Stern/Intra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ putUser uid upd = do
"brig"
b
( method PUT
. versionedPath "/self"
. versionedPath "self"
. header "Z-User" (toByteString' uid)
. header "Z-Connection" (toByteString' "")
. lbytes (encode upd)
Expand Down Expand Up @@ -374,6 +374,7 @@ changeEmail u upd = do
. Bilge.path "i/self/email"
. header "Z-User" (toByteString' u)
. header "Z-Connection" (toByteString' "")
. queryItem "validate" "true"
. lbytes (encode upd)
. contentJson
. expect2xx
Expand All @@ -388,7 +389,7 @@ changePhone u upd = do
"brig"
b
( method PUT
. versionedPath "/self/phone"
. versionedPath "self/phone"
. header "Z-User" (toByteString' u)
. header "Z-Connection" (toByteString' "")
. lbytes (encode upd)
Expand Down Expand Up @@ -680,7 +681,7 @@ getUserConsentValue uid = do
g
( method GET
. header "Z-User" (toByteString' uid)
. versionedPath "/self/consent"
. versionedPath "self/consent"
. expect2xx
)
parseResponse (mkError status502 "bad-upstream") r
Expand Down Expand Up @@ -732,7 +733,7 @@ getUserCookies uid = do
g
( method GET
. header "Z-User" (toByteString' uid)
. versionedPath "/cookies"
. versionedPath "cookies"
. expect2xx
)
parseResponse (mkError status502 "bad-upstream") r
Expand Down Expand Up @@ -777,7 +778,7 @@ getUserClients uid = do
b
( method GET
. header "Z-User" (toByteString' uid)
. versionedPath "/clients"
. versionedPath "clients"
. expect2xx
)
info $ msg ("Response" ++ show r)
Expand All @@ -794,7 +795,7 @@ getUserProperties uid = do
b
( method GET
. header "Z-User" (toByteString' uid)
. versionedPath "/properties"
. versionedPath "properties"
. expect2xx
)
info $ msg ("Response" ++ show r)
Expand Down Expand Up @@ -838,7 +839,7 @@ getUserNotifications uid = do
b
( method GET
. header "Z-User" (toByteString' uid)
. versionedPath "/notifications"
. versionedPath "notifications"
. queryItem "size" (toByteString' batchSize)
. maybe id (queryItem "since" . toByteString') start
. expectStatus (`elem` [200, 404])
Expand Down
9 changes: 8 additions & 1 deletion tools/stern/test/integration/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,16 @@ tests s =
test s "PUT /teams/:tid/billing" testPutTeamBillingInfo,
test s "POST /teams/:tid/billing" testPostTeamBillingInfo,
test s "GET /i/consent" testGetConsentLog,
test s "GET /teams/:id" testGetTeamInfo
test s "GET /teams/:id" testGetTeamInfo,
test s "GET i/user/meta-info?id=..." testGetUserMetaInfo
]

testGetUserMetaInfo :: TestM ()
testGetUserMetaInfo = do
uid <- randomUser
-- Just make sure this returns a 200
void $ getUserMetaInfo uid

testPutPhone :: TestM ()
testPutPhone = pure ()

Expand Down