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
+18 -1
View File
@@ -2,7 +2,7 @@
import json
import re
from collections.abc import Iterable
from collections.abc import Iterable, Mapping
from datetime import datetime, timedelta
from functools import cache
from pathlib import Path
@@ -143,6 +143,23 @@ def assert_error(resp: httpx.Response, status: int) -> dict[str, Any]:
return error
def assert_errors(
responses: Mapping[str, httpx.Response],
status: int,
) -> None:
"""Каждый вариант запроса — ошибка `status` в формате контракта.
Статусы сверяются все разом: при падении видно, что ответил каждый
вариант, а не только первый.
"""
statuses = {name: resp.status_code for name, resp in responses.items()}
assert set(statuses.values()) == {status}, (
f"expected {status} for every variant, got {statuses}"
)
for resp in responses.values():
assert_error(resp, status)
def assert_unauthorized(
resp: httpx.Response,
challenge: str,