refactor: use EnumText for dataset and replace string literals 4 (#33606)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
tmimmanuel
2026-03-18 00:18:08 +00:00
committed by GitHub
parent 0bc6c3a73e
commit 3870b2ad2d
69 changed files with 1027 additions and 849 deletions

View File

@ -16,6 +16,7 @@ from unittest.mock import MagicMock, patch
import pytest
from models.enums import DataSourceType
from tasks.clean_dataset_task import clean_dataset_task
# ============================================================================
@ -116,7 +117,7 @@ def mock_document():
doc.id = str(uuid.uuid4())
doc.tenant_id = str(uuid.uuid4())
doc.dataset_id = str(uuid.uuid4())
doc.data_source_type = "upload_file"
doc.data_source_type = DataSourceType.UPLOAD_FILE
doc.data_source_info = '{"upload_file_id": "test-file-id"}'
doc.data_source_info_dict = {"upload_file_id": "test-file-id"}
return doc

View File

@ -19,6 +19,7 @@ from core.rag.pipeline.queue import TenantIsolatedTaskQueue
from enums.cloud_plan import CloudPlan
from extensions.ext_redis import redis_client
from models.dataset import Dataset, Document
from models.enums import IndexingStatus
from services.document_indexing_proxy.document_indexing_task_proxy import DocumentIndexingTaskProxy
from tasks.document_indexing_task import (
_document_indexing,
@ -424,7 +425,7 @@ class TestBatchProcessing:
# Assert - All documents should be set to 'parsing' status
for doc in mock_documents:
assert doc.indexing_status == "parsing"
assert doc.indexing_status == IndexingStatus.PARSING
assert doc.processing_started_at is not None
# IndexingRunner should be called with all documents
@ -573,7 +574,7 @@ class TestProgressTracking:
# Assert - Status should be 'parsing'
for doc in mock_documents:
assert doc.indexing_status == "parsing"
assert doc.indexing_status == IndexingStatus.PARSING
assert doc.processing_started_at is not None
# Verify commit was called to persist status
@ -1158,7 +1159,7 @@ class TestAdvancedScenarios:
# Assert
# All documents should be set to parsing (no limit errors)
for doc in mock_documents:
assert doc.indexing_status == "parsing"
assert doc.indexing_status == IndexingStatus.PARSING
# IndexingRunner should be called with all documents
mock_indexing_runner.run.assert_called_once()
@ -1377,7 +1378,7 @@ class TestPerformanceScenarios:
# Assert
for doc in mock_documents:
assert doc.indexing_status == "parsing"
assert doc.indexing_status == IndexingStatus.PARSING
mock_indexing_runner.run.assert_called_once()
call_args = mock_indexing_runner.run.call_args[0][0]