GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_readiness_gate_runs_api_contract_audit() -> None:
|
|
script = ROOT / "scripts" / "run_readiness_check.sh"
|
|
content = script.read_text(encoding="utf-8")
|
|
|
|
assert "scripts/audit_api_contracts.py" in content
|
|
|
|
|
|
def test_api_contract_audit_checks_openapi_against_docs() -> None:
|
|
script = ROOT / "scripts" / "audit_api_contracts.py"
|
|
content = script.read_text(encoding="utf-8")
|
|
|
|
assert "create_app" in content
|
|
assert ".openapi()" in content
|
|
assert 'schema.get("paths", {})' in content
|
|
assert "for route in app.routes" not in content
|
|
assert "docs/API_CONTRACTS.md" in content
|
|
assert "Missing documented API route" in content
|
|
assert "Documented API route is not implemented" in content
|
|
assert "Allowed non-envelope endpoint is not implemented" in content
|
|
assert "/api/v1/exports/{export_id}/download" in content
|
|
|
|
|
|
def test_api_contract_docs_include_current_implemented_route_surface() -> None:
|
|
docs = (ROOT / "docs" / "API_CONTRACTS.md").read_text(encoding="utf-8")
|
|
|
|
assert 'GET `/api/v1/projects/{project_id}/areas/{area_id}`' in docs
|
|
assert 'PATCH `/api/v1/projects/{project_id}/areas/{area_id}`' in docs
|
|
assert 'GET `/api/v1/projects/{project_id}/datasets/{dataset_id}/vector/stats`' in docs
|
|
assert 'GET `/api/v1/projects/{project_id}/datasets/{dataset_id}/content`' in docs
|
|
assert 'POST `/api/v1/projects/{project_id}/datasets/{dataset_id}/vector/stats`' not in docs
|