mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-10 14:52:29 +00:00
Return error message from validate_seed
This commit is contained in:
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."
|
||||
Reference in new issue
Block a user