API: branchement init_api dans l'app Dash (#78)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
@app.server.route("/robots.txt")
|
||||
|
||||
@@ -14,3 +14,11 @@ def test_health_returns_ok_without_auth():
|
||||
resp = app.test_client().get("/api/v1/health")
|
||||
assert resp.status_code == 200
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user