Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from pathlib import Path
|
||||
from core.integrity_checker import IntegrityChecker
|
||||
|
||||
|
||||
def test_calculate_and_verify_hash(tmp_path: Path):
|
||||
file = tmp_path / "data.txt"
|
||||
file.write_text("hello", encoding="utf-8")
|
||||
|
||||
hash_file = tmp_path / "data.hash"
|
||||
checker = IntegrityChecker()
|
||||
|
||||
checker.save_hash(file, hash_file)
|
||||
assert checker.verify_hash(file, hash_file)
|
||||
|
||||
# Нарушим целостность
|
||||
file.write_text("changed", encoding="utf-8")
|
||||
assert not checker.verify_hash(file, hash_file)
|
||||
Reference in New Issue
Block a user