mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Add quick unlock flag and event logging
This commit is contained in:
@@ -23,7 +23,7 @@ def test_config_defaults_and_round_trip():
|
||||
assert cfg["pin_hash"] == ""
|
||||
assert cfg["password_hash"] == ""
|
||||
assert cfg["additional_backup_path"] == ""
|
||||
assert cfg["quick_unlock"] is False
|
||||
assert cfg["quick_unlock_enabled"] is False
|
||||
assert cfg["kdf_iterations"] == 50_000
|
||||
|
||||
cfg_mgr.set_pin("1234")
|
||||
|
34
src/tests/test_quick_unlock_default.py
Normal file
34
src/tests/test_quick_unlock_default.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import logging
|
||||
from types import SimpleNamespace
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from seedpass.core.manager import PasswordManager
|
||||
from seedpass.core.config_manager import ConfigManager
|
||||
from helpers import create_vault, TEST_SEED, TEST_PASSWORD
|
||||
|
||||
|
||||
def test_quick_unlock_default_off(tmp_path):
|
||||
vault, _ = create_vault(tmp_path, TEST_SEED, TEST_PASSWORD)
|
||||
cfg_mgr = ConfigManager(vault, tmp_path)
|
||||
assert cfg_mgr.get_quick_unlock() is False
|
||||
|
||||
|
||||
def test_quick_unlock_logs_event(tmp_path, caplog):
|
||||
pm = PasswordManager.__new__(PasswordManager)
|
||||
pm.fingerprint_dir = tmp_path
|
||||
pm.current_fingerprint = "user123"
|
||||
pm.setup_encryption_manager = lambda *a, **k: None
|
||||
pm.initialize_bip85 = lambda: None
|
||||
pm.initialize_managers = lambda: None
|
||||
pm.update_activity = lambda: None
|
||||
pm.config_manager = SimpleNamespace(get_quick_unlock=lambda: True)
|
||||
|
||||
with caplog.at_level(logging.INFO):
|
||||
pm.unlock_vault(password="pw")
|
||||
|
||||
assert any("Quick unlock used by user123" in rec.message for rec in caplog.records)
|
Reference in New Issue
Block a user