mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
fix: update document cleanup logic and mock Celery task in tests
This commit is contained in:
parent
f73c1d83a8
commit
851856a54b
1 changed files with 10 additions and 1 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue