fix(test): verify_integrity sha-mismatch row needs a distinct path (image_record.path is unique)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 18:15:59 -04:00
parent 61b623de48
commit c7f42c10e5
+3 -1
View File
@@ -59,6 +59,8 @@ def test_ok_corrupt_failed_paths(db_sync, tmp_path, monkeypatch):
good = tmp_path / "good.jpg" good = tmp_path / "good.jpg"
_good_jpeg(good) _good_jpeg(good)
good2 = tmp_path / "good2.jpg" # distinct path — image_record.path is unique
_good_jpeg(good2)
bad = tmp_path / "bad.jpg" bad = tmp_path / "bad.jpg"
bad.write_bytes(b"not a real jpeg") bad.write_bytes(b"not a real jpeg")
truncated = tmp_path / "trunc.jpg" truncated = tmp_path / "trunc.jpg"
@@ -66,7 +68,7 @@ def test_ok_corrupt_failed_paths(db_sync, tmp_path, monkeypatch):
truncated.write_bytes(truncated.read_bytes()[:30]) # break the bitstream truncated.write_bytes(truncated.read_bytes()[:30]) # break the bitstream
rec_ok = _rec(db_sync, good, sha=_sha_of(good)) rec_ok = _rec(db_sync, good, sha=_sha_of(good))
rec_sha_mismatch = _rec(db_sync, good, sha="0" * 64) # bytes intact, sha wrong rec_sha_mismatch = _rec(db_sync, good2, sha="0" * 64) # bytes intact, sha wrong → corrupt
rec_decode_fail = _rec(db_sync, truncated, sha=_sha_of(truncated)) rec_decode_fail = _rec(db_sync, truncated, sha=_sha_of(truncated))
# 'bad' has not-jpeg bytes; sha matches the bad bytes → decode fails # 'bad' has not-jpeg bytes; sha matches the bad bytes → decode fails
rec_bad_decode = _rec(db_sync, bad, sha=_sha_of(bad)) rec_bad_decode = _rec(db_sync, bad, sha=_sha_of(bad))