Skip to content

Commit 6b54a71

Browse files
committed
tests: Update requirements and add comprehensive test suite for MongoDB operations
1 parent f7ea61f commit 6b54a71

3 files changed

Lines changed: 820 additions & 3 deletions

File tree

backend/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pytest
1414
pytest-asyncio
1515
pytest-cov
1616
httpx
17+
mongomock
18+
pytest-mock
19+
freezegun
1720

1821
# Static code analysis
1922
flake8

backend/services/data_documents_service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ def update_document(
209209
before_doc = collection.find_one({"_id": ObjectId(document_id)})
210210
# Use replace_one instead of update_one to completely replace the document
211211
# This ensures deleted fields are actually removed
212-
result = collection.replace_one(
213-
{"_id": ObjectId(document_id)}, content
214-
)
212+
result = collection.replace_one({"_id": ObjectId(document_id)}, content)
215213
if result.matched_count == 0:
216214
return None
217215
updated_doc = collection.find_one({"_id": ObjectId(document_id)})

0 commit comments

Comments
 (0)