fix: task 1.5 poster check + fix stuck tests

- Fix structlog format string in folder_scan_service (%(key)d -> kwargs)
- Add nfo_download_poster setting check before poster download
- Create missing NFO fixture files (tvshow.nfo.bad/good) for repair tests
- Fix test_context_used_in_logging to check all call args not format string
- Fix test_system_settings_integration isolation via reset_all_scans
This commit is contained in:
2026-05-13 08:07:16 +02:00
parent eb2fc3c5ab
commit eb0e6e8ccb
5 changed files with 230 additions and 5 deletions

View File

@@ -263,8 +263,9 @@ class TestWithErrorRecoveryDecorator:
fail_once()
# Should have logged a warning with context
mock_logger.warning.assert_called()
logged_msg = mock_logger.warning.call_args[0][0]
assert "my_context" in logged_msg
# context is a %s arg, so check all positional call args
logged_args = mock_logger.warning.call_args[0]
assert any("my_context" in str(arg) for arg in logged_args)
def test_retryable_error_is_retried(self):
"""RetryableError (standard Exception subclass) is retried."""

View File

@@ -10,8 +10,12 @@ async def test_system_settings_integration():
"""Test SystemSettings service with actual database operations."""
# Initialize database
await init_db()
# Test get_or_create (should create on first call)
# Reset all flags to a known-clean state before the test
async with get_db_session() as db:
await SystemSettingsService.reset_all_scans(db)
# Test get_or_create (should return record with all flags False after reset)
async with get_db_session() as db:
settings = await SystemSettingsService.get_or_create(db)
assert settings is not None