18 lines
478 B
Python
18 lines
478 B
Python
|
|
from core.crypto_manager import CryptoManager
|
||
|
|
|
||
|
|
|
||
|
|
def test_encrypt_decrypt_file(tmp_path):
|
||
|
|
file = tmp_path / "plain.txt"
|
||
|
|
file.write_text("super secret", encoding="utf-8")
|
||
|
|
|
||
|
|
enc_file = tmp_path / "plain.enc"
|
||
|
|
dec_file = tmp_path / "plain.dec"
|
||
|
|
|
||
|
|
crypto = CryptoManager()
|
||
|
|
key = crypto.generate_key()
|
||
|
|
|
||
|
|
crypto.encrypt_file(file, key, enc_file)
|
||
|
|
crypto.decrypt_file(enc_file, key, dec_file)
|
||
|
|
|
||
|
|
assert dec_file.read_text(encoding="utf-8") == "super secret"
|