test: verify verify_checksum behavior when file is missing

Added a new test case `test_verify_checksum_missing` to `src/tests/test_checksum_utils.py` to ensure that `verify_checksum` correctly raises `FileNotFoundError` and logs an appropriate error message when the checksum file does not exist. This improves diagnostic reliability for checksum verification failures.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-26 17:13:53 +00:00
1 parent 88781479aa
commit 00d19d90f7
1 file changed
+9
+9
View File
@@ -2,6 +2,7 @@ import hashlib
import json
from pathlib import Path
import pytest
from utils import checksum
@@ -45,3 +46,11 @@ def test_initialize_checksum(tmp_path):
assert checksum.initialize_checksum(str(data), str(chk_file))
expected = hashlib.sha256("payload".encode()).hexdigest()
assert chk_file.read_text() == expected
def test_verify_checksum_missing(tmp_path, caplog):
missing_file = tmp_path / "missing_chk.txt"
with pytest.raises(FileNotFoundError):
checksum.verify_checksum("abc", str(missing_file))
assert f"Checksum file '{missing_file}' not found." in caplog.text