25 lines
850 B
Python
25 lines
850 B
Python
from pathlib import Path
|
|
|
|
from serato_doctor.models.library import Library
|
|
from serato_doctor.models.reference import TrackReference
|
|
from serato_doctor.models.track import DiskTrack
|
|
|
|
|
|
def test_library_reconciles_references_by_filename():
|
|
crate = Path("House.crate")
|
|
references = [
|
|
TrackReference(crate, Path("/old/Found.mp3"), "Found.mp3"),
|
|
TrackReference(crate, Path("/old/Missing.mp3"), "Missing.mp3"),
|
|
]
|
|
tracks = [DiskTrack(Path("/new/Found.mp3"), "Found.mp3", 10, ".mp3")]
|
|
|
|
results = Library.build(references, tracks).reconcile_by_filename()
|
|
|
|
assert [result.exists_by_filename for result in results] == [True, False]
|
|
assert results[1].as_row() == {
|
|
"crate": "House.crate",
|
|
"serato_path": "/old/Missing.mp3",
|
|
"filename": "Missing.mp3",
|
|
"exists_by_filename": False,
|
|
}
|