Add seed import test

This commit is contained in:
thePR0M3TH3AN
2025-06-29 16:17:21 -04:00
parent 3006c59172
commit 90702d58c2

24
tests/test_seed_import.py Normal file
View File

@@ -0,0 +1,24 @@
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
from cryptography.fernet import Fernet
sys.path.append(str(Path(__file__).resolve().parents[1]))
from password_manager.encryption import EncryptionManager
from password_manager.manager import PasswordManager
SEED = "guard rule huge draft embark case any drastic horse bargain orchard mobile"
def test_seed_encryption_round_trip():
with TemporaryDirectory() as tmpdir:
key = Fernet.generate_key()
enc_mgr = EncryptionManager(key, Path(tmpdir))
enc_mgr.encrypt_parent_seed(SEED)
decrypted = enc_mgr.decrypt_parent_seed()
assert decrypted == SEED
pm = PasswordManager.__new__(PasswordManager)
assert pm.validate_bip85_seed(SEED)