Log matched media cleanup files

This commit is contained in:
Abel Luck 2026-06-01 08:45:42 +02:00
parent 87288561b9
commit 89e6a4d78c
4 changed files with 31 additions and 3 deletions

View file

@ -102,6 +102,29 @@ def test_cleanup_media_dry_run_reports_matches_without_deleting(tmp_path: Path)
assert result.failures == 0
def test_cleanup_media_lists_matched_files_before_summary(tmp_path: Path) -> None:
feeds_dir = tmp_path / "feeds"
old_file = feeds_dir / "demo" / "audio" / "old.mp3"
write_media(old_file, b"audio", age_days=40)
output = io.StringIO()
result = cleanup_media(
feeds_dir=feeds_dir,
retention_days=25,
now=NOW,
dry_run=True,
output=output,
)
assert old_file.exists()
assert result.matched_files == 1
output_lines = output.getvalue().splitlines()
assert (
output_lines[0] == f"media cleanup: matched path={old_file.resolve()} bytes=5"
)
assert "matched_files=1" in output_lines[-1]
def test_cleanup_media_uses_configured_media_dirs(tmp_path: Path) -> None:
feeds_dir = tmp_path / "feeds"
demo_dir = feeds_dir / "demo"