Add synthetic sample library
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
from serato_doctor.crate_parser import parse_crates
|
||||
from serato_doctor.models.library import Library
|
||||
from serato_doctor.scanner import scan_audio
|
||||
|
||||
|
||||
def test_generated_sample_library_has_expected_scenario(tmp_path):
|
||||
generator_path = (
|
||||
Path(__file__).parents[1] / "samples" / "small-library" / "generate.py"
|
||||
)
|
||||
build_sample = runpy.run_path(str(generator_path))["build_sample"]
|
||||
sample_root = build_sample(tmp_path / "sample")
|
||||
|
||||
references = parse_crates(sample_root / "Serato" / "_Serato_" / "Subcrates")
|
||||
tracks = scan_audio(sample_root / "Music")
|
||||
results = Library.build(references, tracks).reconcile_by_filename()
|
||||
missing = {
|
||||
result.reference.filename
|
||||
for result in results
|
||||
if not result.exists_by_filename
|
||||
}
|
||||
|
||||
assert len(list((sample_root / "Serato").rglob("*.crate"))) == 7
|
||||
assert len(references) == 13
|
||||
assert len(tracks) == 10
|
||||
assert missing == {"Missing.mp3", "Old Name.mp3"}
|
||||
Reference in New Issue
Block a user