mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 00:09:04 +00:00
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from helpers import create_vault, TEST_SEED, TEST_PASSWORD
|
|
import pytest
|
|
|
|
from seedpass.core.entry_management import EntryManager
|
|
from seedpass.core.backup import BackupManager
|
|
from seedpass.core.config_manager import ConfigManager
|
|
|
|
|
|
def test_modify_totp_entry_period_digits_and_archive(tmp_path):
|
|
vault, _ = create_vault(tmp_path, TEST_SEED, TEST_PASSWORD)
|
|
cfg_mgr = ConfigManager(vault, tmp_path)
|
|
backup_mgr = BackupManager(tmp_path, cfg_mgr)
|
|
em = EntryManager(vault, backup_mgr)
|
|
|
|
em.add_totp("Example", TEST_SEED, period=30, digits=6)
|
|
em.modify_entry(0, period=60, digits=8, archived=True)
|
|
|
|
entry = em.retrieve_entry(0)
|
|
assert entry["period"] == 60
|
|
assert entry["digits"] == 8
|
|
assert entry["archived"] is True
|
|
|
|
|
|
def test_modify_totp_entry_invalid_field(tmp_path):
|
|
vault, _ = create_vault(tmp_path, TEST_SEED, TEST_PASSWORD)
|
|
cfg_mgr = ConfigManager(vault, tmp_path)
|
|
backup_mgr = BackupManager(tmp_path, cfg_mgr)
|
|
em = EntryManager(vault, backup_mgr)
|
|
|
|
em.add_totp("Example", TEST_SEED)
|
|
with pytest.raises(ValueError):
|
|
em.modify_entry(0, username="alice")
|