meal-order-manager/tests/test_openapi_contract.py
Cursor Agent fbd9444a36
fix(api): document 4xx and reject invalid form-status weeks (DEV-289)
Health, form-status, and roster document 400. form-status now maps
current and returns 400 for a week that is not current or YYYY-WNN.
Redocly treats 302 as a success response, matching the portal.

Co-authored-by: Adam Moussa <amoussa1229@users.noreply.github.com>
2026-09-21 23:55:40 +00:00

23 lines
912 B
Python

"""OpenAPI 3.1 + Redocly recommended, matching internal-portal (DEV-289)."""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_openapi_uses_redocly_recommended():
redocly = (ROOT / ".redocly.yaml").read_text()
package = (ROOT / "package.json").read_text()
spec = (ROOT / "openapi.yaml").read_text()
ci = (ROOT / ".github" / "workflows" / "ci.yml").read_text()
assert "extends:" in redocly
assert "- recommended" in redocly
assert "operation-2xx-response: off" in redocly
assert "rule/operation-2xx-or-3xx-response" in redocly
assert "root: openapi.yaml" in redocly
assert '"openapi:lint"' in package
assert '"@redocly/cli": "2.52.1"' in package
assert "npm run openapi:lint" in ci
assert "openapi: 3.1.0" in spec
assert "required: [stage, sha]" in spec
assert "{ error: string }" in spec or "`{ error: string }`" in spec