refactor(core): fix tests

This commit is contained in:
2025-11-14 16:51:21 +01:00
parent 8c20deb690
commit c689caea88

View File

@@ -34,15 +34,16 @@ def test_authenticated_route_requires_auth(client):
async def test_on_after_request_verify_enqueues_email(monkeypatch): async def test_on_after_request_verify_enqueues_email(monkeypatch):
calls = {} calls = {}
def fake_enqueue_email(to: str, subject: str, body: str): class FakeCeleryTask:
calls.setdefault("emails", []).append({ def delay(to: str, subject: str, body: str):
"to": to, calls.setdefault("emails", []).append({
"subject": subject, "to": to,
"body": body, "subject": subject,
}) "body": body,
})
# Patch the enqueue_email used inside user_service # Patch the enqueue_email used inside user_service
monkeypatch.setattr(user_service, "enqueue_email", fake_enqueue_email) monkeypatch.setattr(user_service, "send_email", FakeCeleryTask)
class DummyUser: class DummyUser:
def __init__(self, email): def __init__(self, email):