diff --git a/tests/test_exam_templates.py b/tests/test_exam_templates.py index 346108c..01421c6 100644 --- a/tests/test_exam_templates.py +++ b/tests/test_exam_templates.py @@ -214,6 +214,9 @@ def test_get_template_source_pdf_from_uploaded_file(monkeypatch): } client, _ = make_client(store=store) monkeypatch.setattr(templates_mod, "StorageAdmin", _FakeStorageAdmin) + # The download resolves the files row via service role (sidesteps the broken cabinet_memberships + # RLS recursion) — mock it to the same fake store, like the upload test does. + monkeypatch.setattr(templates_mod, "SupabaseServiceRoleClient", lambda: _FakeServiceRoleClient(store)) resp = client.get("/api/exam/templates/t1/source-pdf") assert resp.status_code == 200 assert resp.headers["content-type"].startswith("application/pdf")