refactor review-plan safety and validation

This commit is contained in:
windyboy
2026-04-07 11:00:47 +08:00
parent fb128c70d6
commit 0a6bddcc7e
19 changed files with 1246 additions and 628 deletions
+15 -13
View File
@@ -82,28 +82,30 @@ class TestQuarantineManager:
assert expected_quarantine_path.read_text() == "test content"
def test_quarantine_anime_file_rejected(self, manager, config):
"""Test that quarantining anime files is rejected."""
"""Test that quarantining anime files returns a failed result."""
# Create a test anime file
anime_file = config.library_root / "anime" / "Test Anime.mkv"
anime_file.write_text("test content")
# Attempt to quarantine should raise ValueError
with pytest.raises(ValueError, match="Quarantine not supported for category 'anime'"):
manager.quarantine_file(anime_file)
result = manager.quarantine_file(anime_file)
assert result.success is False
assert "Quarantine not supported for category 'anime'" in (result.error_message or "")
# Verify file was not moved
assert anime_file.exists()
def test_quarantine_other_file_rejected(self, manager, config):
"""Test that quarantining other files is rejected."""
"""Test that quarantining other files returns a failed result."""
# Create a test other file
other_file = config.library_root / "other" / "Test File.mkv"
other_file.write_text("test content")
# Attempt to quarantine should raise ValueError
with pytest.raises(ValueError, match="Quarantine not supported for category 'other'"):
manager.quarantine_file(other_file)
result = manager.quarantine_file(other_file)
assert result.success is False
assert "Quarantine not supported for category 'other'" in (result.error_message or "")
# Verify file was not moved
assert other_file.exists()