Auto-fill ČSFD links on import, rename in pool, multi-country tags, Filmotéka layout
This commit is contained in:
@@ -107,6 +107,40 @@ class TestHardlinkManager:
|
||||
assert (temp_output_dir / "žánr" / "Komedie" / "file1.txt").exists()
|
||||
assert not (temp_output_dir / "rok").exists()
|
||||
|
||||
def test_create_structure_with_category_roots(self, files_with_tags, temp_output_dir):
|
||||
"""category_roots: genres sit at the output root, rok under 'Dle roku'."""
|
||||
manager = HardlinkManager(temp_output_dir)
|
||||
roots = {"žánr": "", "rok": "Dle roku"}
|
||||
manager.create_structure_for_files(files_with_tags, category_roots=roots)
|
||||
|
||||
# Genres directly at the output root (no "žánr" wrapper folder)
|
||||
assert (temp_output_dir / "Komedie" / "file1.txt").exists()
|
||||
assert (temp_output_dir / "Akční" / "file1.txt").exists()
|
||||
assert (temp_output_dir / "Drama" / "file2.txt").exists()
|
||||
assert not (temp_output_dir / "žánr").exists()
|
||||
|
||||
# Rok grouped under its own "Dle roku" folder
|
||||
assert (temp_output_dir / "Dle roku" / "1988" / "file1.txt").exists()
|
||||
|
||||
def test_sync_with_roots_leaves_unmanaged_mirror_untouched(
|
||||
self, files_with_tags, temp_source_dir, temp_output_dir
|
||||
):
|
||||
"""Cleanup must not delete links in a copy-as-is mirror (e.g. Seriály)."""
|
||||
manager = HardlinkManager(temp_output_dir)
|
||||
roots = {"žánr": "", "rok": "Dle roku"}
|
||||
manager.create_structure_for_files(files_with_tags, category_roots=roots)
|
||||
|
||||
# Simulate a copy-as-is mirror holding a hardlink to a source file
|
||||
mirror = temp_output_dir / "Seriály"
|
||||
mirror.mkdir()
|
||||
mirror_link = mirror / "file1.txt"
|
||||
os.link(temp_source_dir / "file1.txt", mirror_link)
|
||||
|
||||
manager.sync_structure(files_with_tags, category_roots=roots)
|
||||
|
||||
# The mirror (not a managed tag folder) is left alone
|
||||
assert mirror_link.exists()
|
||||
|
||||
def test_dry_run(self, files_with_tags, temp_output_dir):
|
||||
"""Test dry run (bez skutečného vytváření)"""
|
||||
manager = HardlinkManager(temp_output_dir)
|
||||
|
||||
Reference in New Issue
Block a user