re-structure
This commit is contained in:
@@ -9,8 +9,8 @@ from datetime import datetime, timedelta, timezone
|
||||
from unittest.mock import MagicMock, patch
|
||||
from uuid import uuid4
|
||||
|
||||
from inference.data.admin_models import AdminDocument, AdminAnnotation
|
||||
from inference.data.repositories.document_repository import DocumentRepository
|
||||
from backend.data.admin_models import AdminDocument, AdminAnnotation
|
||||
from backend.data.repositories.document_repository import DocumentRepository
|
||||
|
||||
|
||||
class TestDocumentRepository:
|
||||
@@ -95,7 +95,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_create_returns_document_id(self, repo):
|
||||
"""Test create returns document ID."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
mock_ctx.return_value.__exit__ = MagicMock(return_value=False)
|
||||
@@ -113,7 +113,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_create_with_all_parameters(self, repo):
|
||||
"""Test create with all optional parameters."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
mock_ctx.return_value.__exit__ = MagicMock(return_value=False)
|
||||
@@ -145,7 +145,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_returns_document(self, repo, sample_document):
|
||||
"""Test get returns document when exists."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -159,7 +159,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_returns_none_when_not_found(self, repo):
|
||||
"""Test get returns None when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -187,7 +187,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_no_filters(self, repo, sample_document):
|
||||
"""Test get_paginated with no filters."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -201,7 +201,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_status_filter(self, repo, sample_document):
|
||||
"""Test get_paginated with status filter."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -214,7 +214,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_upload_source_filter(self, repo, sample_document):
|
||||
"""Test get_paginated with upload_source filter."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -227,7 +227,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_auto_label_status_filter(self, repo, sample_document):
|
||||
"""Test get_paginated with auto_label_status filter."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -241,7 +241,7 @@ class TestDocumentRepository:
|
||||
def test_get_paginated_with_batch_id_filter(self, repo, sample_document):
|
||||
"""Test get_paginated with batch_id filter."""
|
||||
batch_id = str(uuid4())
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -254,7 +254,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_category_filter(self, repo, sample_document):
|
||||
"""Test get_paginated with category filter."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -267,7 +267,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_has_annotations_true(self, repo, sample_document):
|
||||
"""Test get_paginated with has_annotations=True."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -280,7 +280,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_paginated_with_has_annotations_false(self, repo, sample_document):
|
||||
"""Test get_paginated with has_annotations=False."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
@@ -297,7 +297,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_status(self, repo, sample_document):
|
||||
"""Test update_status updates document status."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -310,7 +310,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_status_with_auto_label_status(self, repo, sample_document):
|
||||
"""Test update_status with auto_label_status."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -326,7 +326,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_status_with_auto_label_error(self, repo, sample_document):
|
||||
"""Test update_status with auto_label_error."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -342,7 +342,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_status_document_not_found(self, repo):
|
||||
"""Test update_status when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -358,7 +358,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_file_path(self, repo, sample_document):
|
||||
"""Test update_file_path updates document file path."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -371,7 +371,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_file_path_document_not_found(self, repo):
|
||||
"""Test update_file_path when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -387,7 +387,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_group_key_returns_true(self, repo, sample_document):
|
||||
"""Test update_group_key returns True when document exists."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -400,7 +400,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_group_key_returns_false(self, repo):
|
||||
"""Test update_group_key returns False when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -416,7 +416,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_category(self, repo, sample_document):
|
||||
"""Test update_category updates document category."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -429,7 +429,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_update_category_returns_none_when_not_found(self, repo):
|
||||
"""Test update_category returns None when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -445,7 +445,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_delete_returns_true_when_exists(self, repo, sample_document):
|
||||
"""Test delete returns True when document exists."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_session.exec.return_value.all.return_value = []
|
||||
@@ -460,7 +460,7 @@ class TestDocumentRepository:
|
||||
def test_delete_with_annotations(self, repo, sample_document):
|
||||
"""Test delete removes annotations before deleting document."""
|
||||
annotation = MagicMock()
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_session.exec.return_value.all.return_value = [annotation]
|
||||
@@ -474,7 +474,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_delete_returns_false_when_not_exists(self, repo):
|
||||
"""Test delete returns False when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -490,7 +490,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_categories(self, repo):
|
||||
"""Test get_categories returns unique categories."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.all.return_value = ["invoice", "receipt", None]
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -506,7 +506,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_labeled_for_export(self, repo, labeled_document):
|
||||
"""Test get_labeled_for_export returns labeled documents."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -519,7 +519,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_labeled_for_export_with_token(self, repo, labeled_document):
|
||||
"""Test get_labeled_for_export with admin_token filter."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -535,7 +535,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_count_by_status(self, repo):
|
||||
"""Test count_by_status returns status counts."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.all.return_value = [
|
||||
("pending", 10),
|
||||
@@ -554,7 +554,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_by_ids(self, repo, sample_document):
|
||||
"""Test get_by_ids returns documents by IDs."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.all.return_value = [sample_document]
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -570,7 +570,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_for_training_basic(self, repo, labeled_document):
|
||||
"""Test get_for_training with default parameters."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
@@ -584,7 +584,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_for_training_with_min_annotation_count(self, repo, labeled_document):
|
||||
"""Test get_for_training with min_annotation_count."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
@@ -597,7 +597,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_for_training_exclude_used(self, repo, labeled_document):
|
||||
"""Test get_for_training with exclude_used_in_training."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
@@ -610,7 +610,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_get_for_training_no_annotations(self, repo, labeled_document):
|
||||
"""Test get_for_training with has_annotations=False."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.exec.return_value.one.return_value = 1
|
||||
mock_session.exec.return_value.all.return_value = [labeled_document]
|
||||
@@ -628,7 +628,7 @@ class TestDocumentRepository:
|
||||
def test_acquire_annotation_lock_success(self, repo, sample_document):
|
||||
"""Test acquire_annotation_lock when no lock exists."""
|
||||
sample_document.annotation_lock_until = None
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -641,7 +641,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_acquire_annotation_lock_fails_when_locked(self, repo, locked_document):
|
||||
"""Test acquire_annotation_lock fails when document is already locked."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = locked_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -653,7 +653,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_acquire_annotation_lock_document_not_found(self, repo):
|
||||
"""Test acquire_annotation_lock when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -669,7 +669,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_release_annotation_lock_success(self, repo, locked_document):
|
||||
"""Test release_annotation_lock releases the lock."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = locked_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -682,7 +682,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_release_annotation_lock_document_not_found(self, repo):
|
||||
"""Test release_annotation_lock when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -699,7 +699,7 @@ class TestDocumentRepository:
|
||||
def test_extend_annotation_lock_success(self, repo, locked_document):
|
||||
"""Test extend_annotation_lock extends the lock."""
|
||||
original_lock = locked_document.annotation_lock_until
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = locked_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -713,7 +713,7 @@ class TestDocumentRepository:
|
||||
def test_extend_annotation_lock_fails_when_no_lock(self, repo, sample_document):
|
||||
"""Test extend_annotation_lock fails when no lock exists."""
|
||||
sample_document.annotation_lock_until = None
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = sample_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -725,7 +725,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_extend_annotation_lock_fails_when_expired(self, repo, expired_lock_document):
|
||||
"""Test extend_annotation_lock fails when lock is expired."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = expired_lock_document
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
@@ -737,7 +737,7 @@ class TestDocumentRepository:
|
||||
|
||||
def test_extend_annotation_lock_document_not_found(self, repo):
|
||||
"""Test extend_annotation_lock when document not found."""
|
||||
with patch("inference.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
with patch("backend.data.repositories.document_repository.get_session_context") as mock_ctx:
|
||||
mock_session = MagicMock()
|
||||
mock_session.get.return_value = None
|
||||
mock_ctx.return_value.__enter__ = MagicMock(return_value=mock_session)
|
||||
|
||||
Reference in New Issue
Block a user