mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 23:38:49 +00:00
Import safe special chars constant
This commit is contained in:
@@ -42,7 +42,12 @@ except ModuleNotFoundError: # pragma: no cover - fallback for removed module
|
||||
|
||||
from local_bip85.bip85 import BIP85
|
||||
|
||||
from constants import DEFAULT_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH
|
||||
from constants import (
|
||||
DEFAULT_PASSWORD_LENGTH,
|
||||
MIN_PASSWORD_LENGTH,
|
||||
MAX_PASSWORD_LENGTH,
|
||||
SAFE_SPECIAL_CHARS,
|
||||
)
|
||||
from .encryption import EncryptionManager
|
||||
|
||||
# Instantiate the logger
|
||||
|
@@ -4,6 +4,8 @@ import sys
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from constants import SAFE_SPECIAL_CHARS
|
||||
|
||||
from seedpass.core.password_generation import PasswordGenerator, PasswordPolicy
|
||||
|
||||
|
||||
@@ -47,3 +49,11 @@ def test_exclude_ambiguous_chars():
|
||||
pw = pg.generate_password(length=32, index=2)
|
||||
for ch in "O0Il1":
|
||||
assert ch not in pw
|
||||
|
||||
|
||||
def test_safe_special_chars_mode():
|
||||
policy = PasswordPolicy(special_mode="safe")
|
||||
pg = make_generator(policy)
|
||||
pw = pg.generate_password(length=32, index=3)
|
||||
specials = [c for c in pw if c in string.punctuation]
|
||||
assert specials and all(c in SAFE_SPECIAL_CHARS for c in specials)
|
||||
|
Reference in New Issue
Block a user