Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2697865
keys-test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
keys-test.cpp
View Options
/*
* This file is part of libkazv.
* SPDX-FileCopyrightText: 2022 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<catch2/catch_all.hpp>
#include
<client-model.hpp>
#include
"client-test-util.hpp"
using
namespace
Kazv
;
TEST_CASE
(
"Query keys"
,
"[client][keys]"
)
{
ClientModel
m
;
m
.
crypto
=
Crypto
{};
m
.
deviceLists
.
track
(
immer
::
flex_vector
<
std
::
string
>
{
"@mew:example.org"
,
"@mew2:example.org"
});
WHEN
(
"We query keys"
)
{
auto
[
res
,
dontCareEffect
]
=
ClientModel
::
update
(
m
,
QueryKeysAction
{
true
});
THEN
(
"It should make a request with a map of empty lists"
)
{
assert1Job
(
res
);
for1stJob
(
res
,
[](
const
auto
&
job
)
{
auto
body
=
json
::
parse
(
std
::
get
<
BytesBody
>
(
job
.
requestBody
()));
REQUIRE
(
body
.
at
(
"device_keys"
).
at
(
"@mew:example.org"
)
==
json
::
array
());
REQUIRE
(
body
.
at
(
"device_keys"
).
at
(
"@mew2:example.org"
)
==
json
::
array
());
});
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Fri, Jul 18, 7:26 AM (13 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
244016
Default Alt Text
keys-test.cpp (1 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment