diff --git a/changelog.d/3-bug-fixes/use-proper-api-in-integration-testsuite b/changelog.d/3-bug-fixes/use-proper-api-in-integration-testsuite new file mode 100644 index 0000000000..522fc02ee7 --- /dev/null +++ b/changelog.d/3-bug-fixes/use-proper-api-in-integration-testsuite @@ -0,0 +1 @@ +addClient used the internal brig API in the integration testsuite when it should use the public one diff --git a/integration/test/API/Brig.hs b/integration/test/API/Brig.hs index 871763d6cd..a3e3e449f4 100644 --- a/integration/test/API/Brig.hs +++ b/integration/test/API/Brig.hs @@ -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" $ diff --git a/integration/test/API/BrigInternal.hs b/integration/test/API/BrigInternal.hs index 03903bfdfe..889427d70a 100644 --- a/integration/test/API/BrigInternal.hs +++ b/integration/test/API/BrigInternal.hs @@ -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) @@ -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 diff --git a/integration/test/Test/Demo.hs b/integration/test/Test/Demo.hs index b8a7e6c815..368f018e4c 100644 --- a/integration/test/Test/Demo.hs +++ b/integration/test/Test/Demo.hs @@ -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