Add read-only analyze command
This commit is contained in:
@@ -84,3 +84,47 @@ def test_cli_accepts_old_reference_root(tmp_path, monkeypatch, capsys):
|
||||
output = capsys.readouterr().out
|
||||
assert "Crate references: 1" in output
|
||||
assert "Missing by filename: 0" in output
|
||||
|
||||
|
||||
def test_analyze_prints_health_without_writing_reports(tmp_path, monkeypatch, capsys):
|
||||
serato = tmp_path / "serato"
|
||||
subcrates = serato / "Subcrates"
|
||||
music = tmp_path / "music"
|
||||
subcrates.mkdir(parents=True)
|
||||
music.mkdir()
|
||||
crate_text = (
|
||||
"Users/sample-user/Jukebox/Found.mp3otrk"
|
||||
"Users/sample-user/Jukebox/Missing.mp3otrk"
|
||||
)
|
||||
(subcrates / "Test.crate").write_bytes(crate_text.encode("utf-16-le"))
|
||||
(music / "Found.mp3").write_bytes(b"synthetic audio")
|
||||
csv_path = tmp_path / "scan.csv"
|
||||
report_path = tmp_path / "report.txt"
|
||||
monkeypatch.setattr(
|
||||
sys,
|
||||
"argv",
|
||||
[
|
||||
"serato-doctor",
|
||||
"analyze",
|
||||
"--serato",
|
||||
str(serato),
|
||||
"--music",
|
||||
str(music),
|
||||
"--out",
|
||||
str(csv_path),
|
||||
"--report",
|
||||
str(report_path),
|
||||
],
|
||||
)
|
||||
|
||||
main()
|
||||
|
||||
output = capsys.readouterr().out
|
||||
assert "Overall Health: 50.0%" in output
|
||||
assert "Tracks: 1" in output
|
||||
assert "Crate References: 2" in output
|
||||
assert "Healthy References: 1" in output
|
||||
assert "Broken References: 1" in output
|
||||
assert "Unused Tracks: 0" in output
|
||||
assert not csv_path.exists()
|
||||
assert not report_path.exists()
|
||||
|
||||
Reference in New Issue
Block a user