feat(api): scaffolding FastAPI con TraceIdMiddleware, /health y routers stub

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Juan
2026-05-10 15:30:38 +02:00
co-authored by Claude Opus 4.7
parent 38d81252c6
commit 1c763d26d8
7 changed files with 107 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
"""Tests del endpoint /health y del TraceIdMiddleware."""
from fastapi.testclient import TestClient
from agentforge_core.main import create_app
def test_health_responde_ok() -> None:
client = TestClient(create_app())
r = client.get("/health")
assert r.status_code == 200
assert r.json() == {"status": "ok"}
def test_trace_id_header_se_devuelve_generado() -> None:
client = TestClient(create_app())
r = client.get("/health")
assert r.headers.get("x-trace-id")
def test_trace_id_header_se_propaga_si_viene_en_la_request() -> None:
client = TestClient(create_app())
r = client.get("/health", headers={"X-Trace-Id": "fixed-123"})
assert r.headers["x-trace-id"] == "fixed-123"