feat: application Courrier V1a socle et tri du jour (tt-2026-11-059)

This commit is contained in:
gemini-ops committed 2026-11-17 12:14:55 +01:00
1 parent 0199477821
commit b51a8bba69
19 files changed
+1731 -2

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import pytest
from fastapi.testclient import TestClient
from app.main import app
def test_health_endpoint_no_auth_required():
client = TestClient(app)
resp = client.get("/health")
assert resp.status_code == 200
data = resp.json()
assert data["status"] == "healthy"
assert data["service"] == "courrier"
assert "+01:00" in data["horodatage"]
def test_missing_cf_access_jwt_returns_401():
client = TestClient(app)
resp = client.get("/api/v1/categories")
assert resp.status_code == 401
assert "Cf-Access-Jwt-Assertion manquant" in resp.json()["detail"]
def test_invalid_cf_access_jwt_returns_401():
client = TestClient(app)
# Token malformé
resp = client.get(
"/api/v1/categories",
headers={"Cf-Access-Jwt-Assertion": "ceci.n-est-pas.un-jwt-valide"}
)
assert resp.status_code == 401
def test_valid_cf_access_jwt_returns_200(client):
resp = client.get("/api/v1/categories")
assert resp.status_code == 200
assert "categories" in resp.json()