"""Tests for incident endpoints – backward‑compatible Bayesian reroute.""" import pytest from fastapi.testclient import TestClient from app.main import app client = TestClient(app) def test_report_incident(): payload = { "component": "api-gateway", "latency_p99": 450.0, "error_rate": 0.0, "service_mesh": "default", "throughput": 100, "source": "test", } resp = client.post("/api/v1/report_incident", json=payload) assert resp.status_code == 200 assert resp.json()["status"] == "recorded" @pytest.mark.xfail(reason="model mismatch – awaiting core framework sync") def test_evaluate_incident_deprecated(): payload = { "component": "checkout", "latency_p99": 450.0, "error_rate": 0.12, "service_mesh": "default", "throughput": 100, "source": "test", } resp = client.post("/api/v1/v1/incidents/evaluate", json=payload) assert resp.status_code == 200 body = resp.json() assert "deprecation_notice" in body assert "healing_intent" in body assert body["healing_intent"]["risk_score"] is not None