refactor default artifacts workspace and path compatibility
This commit is contained in:
@@ -20,6 +20,7 @@ class TestConfig:
|
||||
assert config.series_template == "series/{title}/Season {season:02d}/"
|
||||
assert config.log_level == "INFO"
|
||||
assert config.quarantine_dir == ".quarantine"
|
||||
assert config.workspace_dir == Path("artifacts")
|
||||
assert config.enrichment_providers == ["tmdb"]
|
||||
assert config.plan_max_season == 15
|
||||
assert config.plan_max_episode == 100
|
||||
@@ -80,6 +81,7 @@ class TestLoadConfig:
|
||||
'series_filename': 'S{season:02d}E{episode:02d}{ext}'
|
||||
},
|
||||
'quarantine_dir': '.quarantine',
|
||||
'workspace_dir': 'artifacts',
|
||||
'log_level': 'DEBUG',
|
||||
'plan': {
|
||||
'duplicate_keep': 'by_quality',
|
||||
@@ -100,6 +102,7 @@ class TestLoadConfig:
|
||||
assert config.series_template == 'series/{title}/Season {season:02d}/'
|
||||
assert config.log_level == 'DEBUG'
|
||||
assert config.quarantine_dir == '.quarantine'
|
||||
assert config.workspace_dir == Path('artifacts')
|
||||
assert config.duplicate_keep == 'by_quality'
|
||||
assert config.plan_max_season == 12
|
||||
assert config.plan_max_episode == 80
|
||||
@@ -192,6 +195,20 @@ class TestLoadConfig:
|
||||
assert ".mp4" in config.video_extensions
|
||||
assert config.movie_template == "movie/{title} ({year})/"
|
||||
assert config.log_level == "INFO"
|
||||
assert config.workspace_dir == Path("artifacts")
|
||||
|
||||
def test_load_config_with_workspace_dir(self, tmp_path):
|
||||
"""Test loading config with explicit workspace_dir."""
|
||||
config_file = tmp_path / "config.yaml"
|
||||
config_data = {
|
||||
'library_root': '/mnt/nas/videos',
|
||||
'workspace_dir': 'work/artifacts'
|
||||
}
|
||||
with open(config_file, 'w') as f:
|
||||
yaml.dump(config_data, f)
|
||||
|
||||
config = load_config(config_file)
|
||||
assert config.workspace_dir == Path('work/artifacts')
|
||||
|
||||
def test_load_config_with_custom_categories(self, tmp_path):
|
||||
"""Test loading config with custom categories."""
|
||||
@@ -282,6 +299,7 @@ class TestCreateDefaultConfig:
|
||||
assert 'templates' in data
|
||||
assert 'log_level' in data
|
||||
assert 'quarantine_dir' in data
|
||||
assert 'workspace_dir' in data
|
||||
assert 'enrichment' in data
|
||||
assert 'enrich' in data
|
||||
assert 'plan' in data
|
||||
@@ -308,6 +326,7 @@ class TestCreateDefaultConfig:
|
||||
# Configs should be equivalent
|
||||
assert loaded_config.library_root == created_config.library_root
|
||||
assert loaded_config.video_extensions == created_config.video_extensions
|
||||
assert loaded_config.workspace_dir == created_config.workspace_dir
|
||||
assert loaded_config.movie_template == created_config.movie_template
|
||||
assert loaded_config.log_level == created_config.log_level
|
||||
|
||||
@@ -417,6 +436,15 @@ class TestValidateConfig:
|
||||
|
||||
assert len(errors) > 0
|
||||
assert any("quarantine_dir" in err for err in errors)
|
||||
|
||||
def test_validate_workspace_dir_type(self):
|
||||
"""workspace_dir must be a Path object."""
|
||||
config = Config(
|
||||
library_root=Path("/mnt/nas/videos"),
|
||||
workspace_dir="artifacts", # type: ignore[arg-type]
|
||||
)
|
||||
errors = validate_config(config)
|
||||
assert any("workspace_dir must be a Path object" in err for err in errors)
|
||||
|
||||
def test_validate_multiple_errors(self):
|
||||
"""Test validating config with multiple errors."""
|
||||
|
||||
Reference in New Issue
Block a user