test(api): схема OpenAPI свода 2 допускает Svod2PageResponse рядом с BaseListResponse (AURORA-1843)
Контрольный тест тяжёлых GET (AURORA-1848) требовал одну ссылку на BaseListResponse; режим страниц добавляет второй вариант ответа. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
32d81d82e8
commit
737ff55b42
@ -37,6 +37,7 @@ HEAVY_GET_PATHS = [
|
|||||||
"/api/v1/projects/detail-summary",
|
"/api/v1/projects/detail-summary",
|
||||||
]
|
]
|
||||||
OPENAPI_REF = "#/components/schemas/BaseListResponse_SheetResponse_"
|
OPENAPI_REF = "#/components/schemas/BaseListResponse_SheetResponse_"
|
||||||
|
SVOD2_PATH = "/api/v1/svod/2/{sheet}/{year}"
|
||||||
|
|
||||||
|
|
||||||
def _payload(rows) -> list[dict]:
|
def _payload(rows) -> list[dict]:
|
||||||
@ -105,6 +106,12 @@ def test_openapi_heavy_get_schema_unchanged():
|
|||||||
spec = app.openapi()
|
spec = app.openapi()
|
||||||
for path in HEAVY_GET_PATHS:
|
for path in HEAVY_GET_PATHS:
|
||||||
schema = spec["paths"][path]["get"]["responses"]["200"]["content"]["application/json"]["schema"]
|
schema = spec["paths"][path]["get"]["responses"]["200"]["content"]["application/json"]["schema"]
|
||||||
|
if path == SVOD2_PATH:
|
||||||
|
# AURORA-1843: режим страниц (view/search/фильтры) отдаёт Svod2PageResponse с total,
|
||||||
|
# прежний режим - тот же BaseListResponse[SheetResponse].
|
||||||
|
refs = [item["$ref"] for item in schema.get("anyOf", [])]
|
||||||
|
assert refs == ["#/components/schemas/Svod2PageResponse", OPENAPI_REF], path
|
||||||
|
continue
|
||||||
assert schema == {"$ref": OPENAPI_REF}, path
|
assert schema == {"$ref": OPENAPI_REF}, path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user