Return error message from validate_seed

This commit is contained in:
thePR0M3TH3AN committed 2025-08-02 21:38:16 -04:00
1 parent aeb146f862
commit 2f0eb44a44
2 files changed
+44 -17

No files matched your search

@@ -0,0 +1,30 @@
import sys
from pathlib import Path
import pytest
from cryptography.fernet import Fernet
sys.path.append(str(Path(__file__).resolve().parents[1]))
from seedpass.core.encryption import EncryptionManager
def make_manager(tmp_path):
key = Fernet.generate_key()
return EncryptionManager(key, tmp_path)
def test_validate_seed_valid_mnemonic(tmp_path):
manager = make_manager(tmp_path)
valid = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
is_valid, error = manager.validate_seed(valid)
assert is_valid is True
assert error is None
def test_validate_seed_invalid_mnemonic(tmp_path):
manager = make_manager(tmp_path)
invalid = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon"
is_valid, error = manager.validate_seed(invalid)
assert is_valid is False
assert error == "Invalid seed phrase."