Rename sync_series_from_data_files to sync_legacy_series_to_db
- Rename function to reflect its legacy status - Add deprecation warning log on execution - Update all callers (initialization_service, api/config, fastapi_app) - Update tests to use new name - Add deprecation notice to DEVELOPMENT.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,7 @@ import pytest
|
||||
from src.server.services.anime_service import (
|
||||
AnimeService,
|
||||
AnimeServiceError,
|
||||
sync_series_from_data_files,
|
||||
sync_legacy_series_to_db,
|
||||
)
|
||||
from src.server.services.progress_service import ProgressService
|
||||
|
||||
@@ -1303,7 +1303,7 @@ class TestGetNFOStatisticsSelfManaged:
|
||||
|
||||
|
||||
class TestSyncSeriesFromDataFiles:
|
||||
"""Test module-level sync_series_from_data_files function."""
|
||||
"""Test module-level sync_legacy_series_to_db function."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sync_adds_new_series(self, tmp_path):
|
||||
@@ -1343,7 +1343,7 @@ class TestSyncSeriesFromDataFiles:
|
||||
]
|
||||
MockApp.return_value = mock_app_instance
|
||||
|
||||
count = await sync_series_from_data_files(str(tmp_path))
|
||||
count = await sync_legacy_series_to_db(str(tmp_path))
|
||||
|
||||
assert count == 1
|
||||
mock_create.assert_called_once()
|
||||
@@ -1382,7 +1382,7 @@ class TestSyncSeriesFromDataFiles:
|
||||
]
|
||||
MockApp.return_value = mock_app_instance
|
||||
|
||||
count = await sync_series_from_data_files(str(tmp_path))
|
||||
count = await sync_legacy_series_to_db(str(tmp_path))
|
||||
|
||||
assert count == 0
|
||||
mock_create.assert_not_called()
|
||||
@@ -1397,7 +1397,7 @@ class TestSyncSeriesFromDataFiles:
|
||||
mock_app_instance.get_all_series_from_data_files.return_value = []
|
||||
MockApp.return_value = mock_app_instance
|
||||
|
||||
count = await sync_series_from_data_files(str(tmp_path))
|
||||
count = await sync_legacy_series_to_db(str(tmp_path))
|
||||
|
||||
assert count == 0
|
||||
|
||||
@@ -1436,7 +1436,7 @@ class TestSyncSeriesFromDataFiles:
|
||||
]
|
||||
MockApp.return_value = mock_app_instance
|
||||
|
||||
count = await sync_series_from_data_files(str(tmp_path))
|
||||
count = await sync_legacy_series_to_db(str(tmp_path))
|
||||
|
||||
assert count == 1
|
||||
# The name should have been set to folder
|
||||
|
||||
@@ -160,7 +160,7 @@ class TestSyncAnimeFolders:
|
||||
@pytest.mark.asyncio
|
||||
async def test_sync_anime_folders_without_progress(self):
|
||||
"""Test syncing anime folders without progress service."""
|
||||
with patch('src.server.services.initialization_service.sync_series_from_data_files',
|
||||
with patch('src.server.services.initialization_service.sync_legacy_series_to_db',
|
||||
new_callable=AsyncMock, return_value=42) as mock_sync:
|
||||
result = await _sync_anime_folders()
|
||||
|
||||
@@ -172,7 +172,7 @@ class TestSyncAnimeFolders:
|
||||
"""Test syncing anime folders with progress updates."""
|
||||
mock_progress = AsyncMock()
|
||||
|
||||
with patch('src.server.services.initialization_service.sync_series_from_data_files',
|
||||
with patch('src.server.services.initialization_service.sync_legacy_series_to_db',
|
||||
new_callable=AsyncMock, return_value=10) as mock_sync:
|
||||
result = await _sync_anime_folders(progress_service=mock_progress)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user