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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addClient used the internal brig API in the integration testsuite when it should use the public one
4 changes: 1 addition & 3 deletions integration/test/API/Brig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,13 @@ instance Default AddClient where
acapabilities = Just ["legalhold-implicit-consent"]
}

-- | https://staging-nginz-https.zinfra.io/api-internal/swagger-ui/brig/#/brig/post_i_clients__uid_
addClient ::
(HasCallStack, MakesValue user) =>
user ->
AddClient ->
App Response
addClient user args = do
uid <- objId user
req <- baseRequest user Brig Unversioned $ "/i/clients/" <> uid
req <- baseRequest user Brig Versioned $ "/clients/"
pks <- maybe (fmap pure getPrekey) pure args.prekeys
lpk <- maybe getLastPrekey pure args.lastPrekey
submit "POST" $
Expand Down
23 changes: 23 additions & 0 deletions integration/test/API/BrigInternal.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module API.BrigInternal where

import API.Brig (AddClient (..))
import API.Common
import qualified Data.Aeson as Aeson
import Data.Aeson.Types (Pair)
Expand Down Expand Up @@ -27,6 +28,28 @@ instance Default CreateUser where
supportedProtocols = Nothing
}

iAddClient ::
(HasCallStack, MakesValue user) =>
user ->
AddClient ->
App Response
iAddClient user args = do
uid <- objId user
req <- baseRequest user Brig Unversioned $ "/i/clients/" <> uid
pks <- maybe (fmap pure getPrekey) pure args.prekeys
lpk <- maybe getLastPrekey pure args.lastPrekey
submit "POST" $
req
& addJSONObject
[ "prekeys" .= pks,
"lastkey" .= lpk,
"type" .= args.ctype,
"label" .= args.clabel,
"model" .= args.model,
"password" .= args.password,
"capabilities" .= args.acapabilities
]

createUser :: (HasCallStack, MakesValue domain) => domain -> CreateUser -> App Response
createUser domain cu = do
re <- randomEmail
Expand Down
2 changes: 1 addition & 1 deletion integration/test/Test/Demo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ testCantDeleteLHClient :: HasCallStack => App ()
testCantDeleteLHClient = do
user <- randomUser OwnDomain def
client <-
BrigP.addClient user def {BrigP.ctype = "legalhold", BrigP.internal = True}
BrigI.iAddClient user def {BrigP.ctype = "legalhold", BrigP.internal = True}
>>= getJSON 201

bindResponse (BrigP.deleteClient user client) $ \resp -> do
Expand Down