test(brevo): test d'intégration sandbox optionnel (#87)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-06-24 15:35:23 +02:00
parent 162bc550c0
commit c0927c718d
2 changed files with 25 additions and 0 deletions
+3
View File
@@ -62,3 +62,6 @@ env = [
"DATA_SCHEMA_LOCAL=/home/colin/git/decp-processing/dist/schema.json", "DATA_SCHEMA_LOCAL=/home/colin/git/decp-processing/dist/schema.json",
] ]
addopts = "-p no:warnings" addopts = "-p no:warnings"
markers = [
"integration: tests touchant des services externes (Brevo) ; skippés par défaut en CI",
]
+22
View File
@@ -0,0 +1,22 @@
import os
import pytest
from src.auth import mailer
pytestmark = pytest.mark.integration
@pytest.mark.skipif(
not os.getenv("BREVO_API_KEY"),
reason="BREVO_API_KEY absent — test d'intégration Brevo ignoré",
)
def test_send_verification_email_sandbox(monkeypatch):
# Force le mode sandbox : Brevo valide la requête sans délivrer.
monkeypatch.setenv("BREVO_SANDBOX", "true")
monkeypatch.setenv("APP_BASE_URL", "http://localhost:8050")
mailer.init_mailer()
# Ne doit pas lever : l'API Brevo accepte la requête en sandbox.
mailer.send_verification_email(
os.getenv("MAIL_FROM", "noreply@decp.info"), "INTEGRATION_TOKEN"
)