re-structure
This commit is contained in:
@@ -28,7 +28,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_invoice_number_and_bankgiro_is_complete(self):
|
||||
"""Document with invoice_number + bankgiro should be complete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 0, "class_name": "invoice_number"},
|
||||
@@ -39,7 +39,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_ocr_number_and_plusgiro_is_complete(self):
|
||||
"""Document with ocr_number + plusgiro should be complete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 3, "class_name": "ocr_number"},
|
||||
@@ -50,7 +50,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_invoice_number_and_plusgiro_is_complete(self):
|
||||
"""Document with invoice_number + plusgiro should be complete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 0, "class_name": "invoice_number"},
|
||||
@@ -61,7 +61,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_ocr_number_and_bankgiro_is_complete(self):
|
||||
"""Document with ocr_number + bankgiro should be complete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 3, "class_name": "ocr_number"},
|
||||
@@ -72,7 +72,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_only_identifier_is_incomplete(self):
|
||||
"""Document with only identifier field should be incomplete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 0, "class_name": "invoice_number"},
|
||||
@@ -82,7 +82,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_only_payment_is_incomplete(self):
|
||||
"""Document with only payment field should be incomplete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 4, "class_name": "bankgiro"},
|
||||
@@ -92,13 +92,13 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_no_annotations_is_incomplete(self):
|
||||
"""Document with no annotations should be incomplete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
assert is_annotation_complete([]) is False
|
||||
|
||||
def test_document_with_other_fields_only_is_incomplete(self):
|
||||
"""Document with only non-essential fields should be incomplete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 1, "class_name": "invoice_date"},
|
||||
@@ -109,7 +109,7 @@ class TestAnnotationCompletenessLogic:
|
||||
|
||||
def test_document_with_all_fields_is_complete(self):
|
||||
"""Document with all fields should be complete."""
|
||||
from inference.web.services.dashboard_service import is_annotation_complete
|
||||
from backend.web.services.dashboard_service import is_annotation_complete
|
||||
|
||||
annotations = [
|
||||
{"class_id": 0, "class_name": "invoice_number"},
|
||||
@@ -178,7 +178,7 @@ class TestDashboardSchemas:
|
||||
|
||||
def test_dashboard_stats_response_schema(self):
|
||||
"""Test DashboardStatsResponse schema validation."""
|
||||
from inference.web.schemas.admin import DashboardStatsResponse
|
||||
from backend.web.schemas.admin import DashboardStatsResponse
|
||||
|
||||
response = DashboardStatsResponse(
|
||||
total_documents=38,
|
||||
@@ -195,10 +195,10 @@ class TestDashboardSchemas:
|
||||
assert response.completeness_rate == 75.76
|
||||
|
||||
def test_active_model_response_schema(self):
|
||||
"""Test ActiveModelResponse schema with null model."""
|
||||
from inference.web.schemas.admin import ActiveModelResponse
|
||||
"""Test DashboardActiveModelResponse schema with null model."""
|
||||
from backend.web.schemas.admin import DashboardActiveModelResponse
|
||||
|
||||
response = ActiveModelResponse(
|
||||
response = DashboardActiveModelResponse(
|
||||
model=None,
|
||||
running_training=None,
|
||||
)
|
||||
@@ -208,7 +208,7 @@ class TestDashboardSchemas:
|
||||
|
||||
def test_active_model_info_schema(self):
|
||||
"""Test ActiveModelInfo schema validation."""
|
||||
from inference.web.schemas.admin import ActiveModelInfo
|
||||
from backend.web.schemas.admin import ActiveModelInfo
|
||||
|
||||
model = ActiveModelInfo(
|
||||
version_id=TEST_MODEL_UUID,
|
||||
@@ -227,7 +227,7 @@ class TestDashboardSchemas:
|
||||
|
||||
def test_running_training_info_schema(self):
|
||||
"""Test RunningTrainingInfo schema validation."""
|
||||
from inference.web.schemas.admin import RunningTrainingInfo
|
||||
from backend.web.schemas.admin import RunningTrainingInfo
|
||||
|
||||
task = RunningTrainingInfo(
|
||||
task_id=TEST_TASK_UUID,
|
||||
@@ -243,7 +243,7 @@ class TestDashboardSchemas:
|
||||
|
||||
def test_activity_item_schema(self):
|
||||
"""Test ActivityItem schema validation."""
|
||||
from inference.web.schemas.admin import ActivityItem
|
||||
from backend.web.schemas.admin import ActivityItem
|
||||
|
||||
activity = ActivityItem(
|
||||
type="model_activated",
|
||||
@@ -258,7 +258,7 @@ class TestDashboardSchemas:
|
||||
|
||||
def test_recent_activity_response_schema(self):
|
||||
"""Test RecentActivityResponse schema with empty activities."""
|
||||
from inference.web.schemas.admin import RecentActivityResponse
|
||||
from backend.web.schemas.admin import RecentActivityResponse
|
||||
|
||||
response = RecentActivityResponse(activities=[])
|
||||
|
||||
@@ -270,7 +270,7 @@ class TestDashboardRouterCreation:
|
||||
|
||||
def test_creates_router_with_expected_endpoints(self):
|
||||
"""Test router is created with expected endpoint paths."""
|
||||
from inference.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
from backend.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
|
||||
router = create_dashboard_router()
|
||||
|
||||
@@ -282,7 +282,7 @@ class TestDashboardRouterCreation:
|
||||
|
||||
def test_router_has_correct_prefix(self):
|
||||
"""Test router has /admin/dashboard prefix."""
|
||||
from inference.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
from backend.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
|
||||
router = create_dashboard_router()
|
||||
|
||||
@@ -290,7 +290,7 @@ class TestDashboardRouterCreation:
|
||||
|
||||
def test_router_has_dashboard_tag(self):
|
||||
"""Test router uses Dashboard tag."""
|
||||
from inference.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
from backend.web.api.v1.admin.dashboard import create_dashboard_router
|
||||
|
||||
router = create_dashboard_router()
|
||||
|
||||
@@ -302,7 +302,7 @@ class TestFieldClassIds:
|
||||
|
||||
def test_identifier_class_ids(self):
|
||||
"""Test identifier field class IDs."""
|
||||
from inference.web.services.dashboard_service import IDENTIFIER_CLASS_IDS
|
||||
from backend.web.services.dashboard_service import IDENTIFIER_CLASS_IDS
|
||||
|
||||
# invoice_number = 0, ocr_number = 3
|
||||
assert 0 in IDENTIFIER_CLASS_IDS
|
||||
@@ -310,7 +310,7 @@ class TestFieldClassIds:
|
||||
|
||||
def test_payment_class_ids(self):
|
||||
"""Test payment field class IDs."""
|
||||
from inference.web.services.dashboard_service import PAYMENT_CLASS_IDS
|
||||
from backend.web.services.dashboard_service import PAYMENT_CLASS_IDS
|
||||
|
||||
# bankgiro = 4, plusgiro = 5
|
||||
assert 4 in PAYMENT_CLASS_IDS
|
||||
|
||||
Reference in New Issue
Block a user