-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use HasTests to save a few LOC. * Fix/extend client CRUD api. - moved internal add from API.Brig to API.BrigInternal - created API.BrigCommon for data structured needed in both - added public add * Tranlate tests: manually add/delete client. * Fiddle with test case type abstractions. * Remove obsolete test from integration/test/Test/Demo.hs
- Loading branch information
Showing
11 changed files
with
333 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Translate integration tests: manually add / delete LH device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module API.BrigCommon where | ||
|
||
import API.Common | ||
import Data.Aeson.Types (Pair) | ||
import Data.Maybe | ||
import Testlib.Prelude as Prelude | ||
|
||
data AddClient = AddClient | ||
{ ctype :: String, -- "temporary", "permanent", "legalhold" | ||
internal :: Bool, | ||
clabel :: String, | ||
model :: String, | ||
prekeys :: Maybe [Value], | ||
lastPrekey :: Maybe Value, | ||
password :: String, | ||
acapabilities :: Maybe [String] | ||
} | ||
|
||
instance Default AddClient where | ||
def = | ||
AddClient | ||
{ ctype = "permanent", | ||
internal = False, | ||
clabel = "Test Device", | ||
model = "Test Model", | ||
prekeys = Nothing, | ||
lastPrekey = Nothing, | ||
password = defPassword, | ||
acapabilities = Just ["legalhold-implicit-consent"] | ||
} | ||
|
||
mkAddClientValue :: AddClient -> App [Pair] | ||
mkAddClientValue args = do | ||
pks <- maybe (fmap pure getPrekey) pure args.prekeys | ||
lpk <- maybe getLastPrekey pure args.lastPrekey | ||
pure | ||
[ "prekeys" .= pks, | ||
"lastkey" .= lpk, | ||
"type" .= args.ctype, | ||
"label" .= args.clabel, | ||
"model" .= args.model, | ||
"password" .= args.password, | ||
"capabilities" .= args.acapabilities | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.