API: branchement init_api dans l'app Dash (#78)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-05-13 14:07:47 +02:00
parent f24d0ba168
commit 686218c639
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -51,6 +51,10 @@ cache.init_app(
}, },
) )
from src.api import init_api # noqa: E402 # inline: src.db.conn must be ready first
init_api(app.server)
# robots.txt # robots.txt
@app.server.route("/robots.txt") @app.server.route("/robots.txt")
+8
View File
@@ -14,3 +14,11 @@ def test_health_returns_ok_without_auth():
resp = app.test_client().get("/api/v1/health") resp = app.test_client().get("/api/v1/health")
assert resp.status_code == 200 assert resp.status_code == 200
assert resp.get_json() == {"status": "ok"} assert resp.get_json() == {"status": "ok"}
def test_health_via_real_app():
"""Vérifie que init_api est bien branché dans src.app."""
from src.app import app as dash_app
resp = dash_app.server.test_client().get("/api/v1/health")
assert resp.status_code == 200