chore: snapshot current project updates
This commit is contained in:
+54
-1
@@ -21,6 +21,9 @@ class TestConfig:
|
||||
assert config.log_level == "INFO"
|
||||
assert config.quarantine_dir == ".quarantine"
|
||||
assert config.enrichment_providers == ["tmdb"]
|
||||
assert config.plan_max_season == 15
|
||||
assert config.plan_max_episode == 100
|
||||
assert config.plan_include_sample_files is False
|
||||
|
||||
def test_config_creation_with_custom_values(self):
|
||||
"""Test creating Config with custom values."""
|
||||
@@ -77,7 +80,13 @@ class TestLoadConfig:
|
||||
'series_filename': 'S{season:02d}E{episode:02d}{ext}'
|
||||
},
|
||||
'quarantine_dir': '.quarantine',
|
||||
'log_level': 'DEBUG'
|
||||
'log_level': 'DEBUG',
|
||||
'plan': {
|
||||
'duplicate_keep': 'by_quality',
|
||||
'max_season': 12,
|
||||
'max_episode': 80,
|
||||
'include_sample_files': True,
|
||||
}
|
||||
}
|
||||
|
||||
with open(config_file, 'w') as f:
|
||||
@@ -91,6 +100,10 @@ class TestLoadConfig:
|
||||
assert config.series_template == 'series/{title}/Season {season:02d}/'
|
||||
assert config.log_level == 'DEBUG'
|
||||
assert config.quarantine_dir == '.quarantine'
|
||||
assert config.duplicate_keep == 'by_quality'
|
||||
assert config.plan_max_season == 12
|
||||
assert config.plan_max_episode == 80
|
||||
assert config.plan_include_sample_files is True
|
||||
|
||||
def test_load_config_with_home_directory(self, tmp_path):
|
||||
"""Test loading config with ~ in library_root."""
|
||||
@@ -107,6 +120,22 @@ class TestLoadConfig:
|
||||
|
||||
# Should expand ~ to home directory
|
||||
assert config.library_root == Path.home() / "Videos"
|
||||
|
||||
def test_load_config_with_reputation_quality_time_strategy(self, tmp_path):
|
||||
"""Test loading config with by_reputation_quality_time strategy."""
|
||||
config_file = tmp_path / "config.yaml"
|
||||
config_data = {
|
||||
'library_root': '/mnt/nas/videos',
|
||||
'plan': {
|
||||
'duplicate_keep': 'by_reputation_quality_time'
|
||||
}
|
||||
}
|
||||
|
||||
with open(config_file, 'w') as f:
|
||||
yaml.dump(config_data, f)
|
||||
|
||||
config = load_config(config_file)
|
||||
assert config.duplicate_keep == 'by_reputation_quality_time'
|
||||
|
||||
def test_load_config_missing_file(self, tmp_path):
|
||||
"""Test loading non-existent configuration file."""
|
||||
@@ -255,6 +284,10 @@ class TestCreateDefaultConfig:
|
||||
assert 'quarantine_dir' in data
|
||||
assert 'enrichment' in data
|
||||
assert 'enrich' in data
|
||||
assert 'plan' in data
|
||||
assert 'max_season' in data['plan']
|
||||
assert 'max_episode' in data['plan']
|
||||
assert 'include_sample_files' in data['plan']
|
||||
|
||||
def test_create_default_config_creates_parent_dirs(self, tmp_path):
|
||||
"""Test that create_default_config creates parent directories."""
|
||||
@@ -399,6 +432,15 @@ class TestValidateConfig:
|
||||
# Should have multiple errors
|
||||
assert len(errors) >= 4
|
||||
|
||||
def test_validate_duplicate_keep_reputation_quality_time(self):
|
||||
"""Test validating config with by_reputation_quality_time strategy."""
|
||||
config = Config(
|
||||
library_root=Path("/mnt/nas/videos"),
|
||||
duplicate_keep="by_reputation_quality_time"
|
||||
)
|
||||
errors = validate_config(config)
|
||||
assert errors == []
|
||||
|
||||
def test_validate_empty_categories(self):
|
||||
"""Test validating config with empty categories."""
|
||||
config = Config(library_root=Path("/test"), categories={})
|
||||
@@ -523,6 +565,17 @@ class TestValidateConfig:
|
||||
errors = validate_config(config)
|
||||
assert any("empty directory name" in e for e in errors)
|
||||
|
||||
def test_validate_invalid_plan_thresholds(self):
|
||||
"""Plan season/episode thresholds must be positive integers."""
|
||||
config = Config(
|
||||
library_root=Path("/test"),
|
||||
plan_max_season=0,
|
||||
plan_max_episode=-1,
|
||||
)
|
||||
errors = validate_config(config)
|
||||
assert any("plan_max_season" in e for e in errors)
|
||||
assert any("plan_max_episode" in e for e in errors)
|
||||
|
||||
|
||||
class TestConfigIntegration:
|
||||
"""Integration tests for configuration workflow."""
|
||||
|
||||
Reference in New Issue
Block a user