Cache the immutable message statement and validate scaling evidence
This commit is contained in:
@@ -95,12 +95,22 @@ async def test_key_is_scoped_by_user_and_chat(client: AsyncClient) -> None:
|
||||
bob = await register(client, "bob")
|
||||
chat = await make_chat(client, alice, bob)
|
||||
other = await make_chat(client, alice)
|
||||
ids = {
|
||||
(await send(client, chat, alice, "алиса", "shared-1")).json()["id"],
|
||||
(await send(client, chat, bob, "боб", "shared-1")).json()["id"],
|
||||
(await send(client, other, alice, "другой чат", "shared-1")).json()["id"],
|
||||
}
|
||||
cases = [(chat, alice, "алиса"), (chat, bob, "боб"), (other, alice, "другой чат")]
|
||||
messages = []
|
||||
for target, user, text in cases:
|
||||
response = await send(client, target, user, text, "shared-1")
|
||||
assert response.status_code == 201
|
||||
message = response.json()
|
||||
assert (message["chat_id"], message["sender_id"], message["text"]) == (
|
||||
target["id"],
|
||||
user["id"],
|
||||
text,
|
||||
)
|
||||
messages.append(message)
|
||||
ids = {message["id"] for message in messages}
|
||||
assert len(ids) == 3
|
||||
for (target, user, text), message in zip(cases, messages, strict=True):
|
||||
assert (await send(client, target, user, text, "shared-1")).json() == message
|
||||
|
||||
|
||||
async def test_replay_checks_session_and_access_again(client: AsyncClient) -> None:
|
||||
|
||||
Reference in New Issue
Block a user