test: cover tampered cursors and UUID input forms

Add black-box tests for the strict-id-validation change: a server-issued
cursor with one field changed (non-string or non-canonical item id,
v=true, extra field) on both lists, member_ids with values of other JSON
types, a non-array member_ids and other UUID notations, and chat_id in
the path of the three chat endpoints. Sync the change's delta specs into
api-conventions, chats and pagination so the coverage check knows the
new scenarios.

The cursor and UUID-notation tests fail on the current code by design;
the fix follows in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 12:51:16 +03:00
co-authored by Claude Opus 5.5
parent 40f470f5b4
commit c5d5a1ab25
14 changed files with 1032 additions and 10 deletions
+31 -2
View File
@@ -7,14 +7,14 @@ import httpx
import pytest
from api_client import API, Actor, Api
from contract import assert_error, assert_ok
from contract import assert_error, assert_errors, assert_ok
def create_raw(
api: Api,
actor: Actor,
title: str,
member_ids: list[str],
member_ids: Any,
) -> httpx.Response:
return api.request(
"POST",
@@ -78,6 +78,35 @@ def test_empty_members(api: Api, alice: Actor) -> None:
assert_error(create_raw(api, alice, "Empty", []), 400)
@pytest.mark.spec("chats", "Участник в верхнем регистре")
def test_member_in_upper_case(api: Api, alice: Actor, bob: Actor) -> None:
resp = create_raw(api, alice, "Upper", [alice.id, bob.id.upper()])
chat = assert_ok(resp, 201, "Chat")
assert chat["member_ids"] == [alice.id, bob.id]
assert chat["id"] in listed_ids(api, bob)
@pytest.mark.spec("chats", "Повтор участника в другом регистре")
def test_duplicate_member_other_case(api: Api, alice: Actor) -> None:
title = f"rejected-{uuid.uuid4().hex}"
member_ids = [alice.id, alice.id.upper()]
assert_error(create_raw(api, alice, title, member_ids), 400)
assert title not in listed_titles(api, alice)
@pytest.mark.spec("chats", "member_ids не массив")
def test_member_ids_not_array(api: Api, alice: Actor) -> None:
title = f"rejected-{uuid.uuid4().hex}"
assert_errors(
{
repr(member_ids): create_raw(api, alice, title, member_ids)
for member_ids in ({}, 123, False, alice.id)
},
400,
)
assert title not in listed_titles(api, alice)
@pytest.mark.spec("chats", "Участник")
def test_member_reads_chat(
api: Api,