mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
refactor(core): fix tests
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user