feat(brevo): envoyer les emails transactionnels via l'API Brevo v5 (#87)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-06-24 15:33:14 +02:00
parent 570f9f4153
commit e4c291a785
4 changed files with 123 additions and 103 deletions
+25 -4
View File
@@ -31,7 +31,28 @@ def client(app):
@pytest.fixture
def mail_outbox(app):
mail = app.extensions["mail"]
with mail.record_messages() as outbox:
yield outbox
def mail_outbox(app, monkeypatch):
from src.auth import mailer
calls = []
class _Msg:
def __init__(self, call):
self._call = call
@property
def recipients(self):
return [to.email for to in self._call["to"]]
class _FakeTransac:
def send_transac_email(self, **kwargs):
calls.append(_Msg(kwargs))
class _FakeClient:
def __init__(self):
self.transactional_emails = _FakeTransac()
monkeypatch.setattr(mailer, "_client", _FakeClient())
monkeypatch.setenv("BREVO_TEMPLATE_VERIFY_ID", "11")
monkeypatch.setenv("BREVO_TEMPLATE_RESET_ID", "22")
yield calls