Skip to content

Commit 851856a

Browse files
committed
fix: update document cleanup logic and mock Celery task in tests
1 parent f73c1d8 commit 851856a

File tree

1 file changed

+10
-1
lines changed
  • surfsense_backend/tests/integration/document_upload

1 file changed

+10
-1
lines changed

surfsense_backend/tests/integration/document_upload/conftest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def _cleanup_documents(
183183
for doc_id in cleanup_doc_ids:
184184
try:
185185
resp = await delete_document(client, headers, doc_id)
186-
if resp.status_code == 409:
186+
if resp.status_code != 200:
187187
remaining_ids.append(doc_id)
188188
except Exception:
189189
remaining_ids.append(doc_id)
@@ -274,6 +274,15 @@ def _mock_external_apis(monkeypatch):
274274
)
275275

276276

277+
@pytest.fixture(autouse=True)
278+
def _mock_celery_delete_task(monkeypatch):
279+
"""Mock Celery delete dispatch — no broker is available in CI."""
280+
monkeypatch.setattr(
281+
"app.tasks.celery_tasks.document_tasks.delete_document_task.delay",
282+
lambda *args, **kwargs: None,
283+
)
284+
285+
277286
@pytest.fixture(autouse=True)
278287
def _mock_redis_heartbeat(monkeypatch):
279288
"""Mock Redis heartbeat — Redis is an external infrastructure boundary."""

0 commit comments

Comments
 (0)