diff --git a/surfsense_backend/tests/integration/document_upload/conftest.py b/surfsense_backend/tests/integration/document_upload/conftest.py index 45cfef7ac..1f1c7df59 100644 --- a/surfsense_backend/tests/integration/document_upload/conftest.py +++ b/surfsense_backend/tests/integration/document_upload/conftest.py @@ -183,7 +183,7 @@ async def _cleanup_documents( for doc_id in cleanup_doc_ids: try: resp = await delete_document(client, headers, doc_id) - if resp.status_code == 409: + if resp.status_code != 200: remaining_ids.append(doc_id) except Exception: remaining_ids.append(doc_id) @@ -274,6 +274,15 @@ def _mock_external_apis(monkeypatch): ) +@pytest.fixture(autouse=True) +def _mock_celery_delete_task(monkeypatch): + """Mock Celery delete dispatch — no broker is available in CI.""" + monkeypatch.setattr( + "app.tasks.celery_tasks.document_tasks.delete_document_task.delay", + lambda *args, **kwargs: None, + ) + + @pytest.fixture(autouse=True) def _mock_redis_heartbeat(monkeypatch): """Mock Redis heartbeat — Redis is an external infrastructure boundary."""