mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 08:19:23 +00:00
Add TOTP export via CLI and API
This commit is contained in:
@@ -112,6 +112,16 @@ def test_update_config_secret_mode(client):
|
||||
assert called["val"] is True
|
||||
|
||||
|
||||
def test_totp_export_endpoint(client):
|
||||
cl, token = client
|
||||
api._pm.entry_manager.export_totp_entries = lambda seed: {"entries": ["x"]}
|
||||
api._pm.parent_seed = "seed"
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
res = cl.get("/api/v1/totp/export", headers=headers)
|
||||
assert res.status_code == 200
|
||||
assert res.json() == {"entries": ["x"]}
|
||||
|
||||
|
||||
def test_fingerprint_endpoints(client):
|
||||
cl, token = client
|
||||
calls = {}
|
||||
|
@@ -353,6 +353,26 @@ def test_entry_unarchive(monkeypatch):
|
||||
assert called["id"] == 4
|
||||
|
||||
|
||||
def test_entry_export_totp(monkeypatch, tmp_path):
|
||||
called = {}
|
||||
|
||||
pm = SimpleNamespace(
|
||||
entry_manager=SimpleNamespace(
|
||||
export_totp_entries=lambda seed: called.setdefault("called", True)
|
||||
or {"entries": []}
|
||||
),
|
||||
parent_seed="seed",
|
||||
select_fingerprint=lambda fp: None,
|
||||
)
|
||||
monkeypatch.setattr(cli, "PasswordManager", lambda: pm)
|
||||
|
||||
out = tmp_path / "t.json"
|
||||
result = runner.invoke(app, ["entry", "export-totp", "--file", str(out)])
|
||||
assert result.exit_code == 0
|
||||
assert out.exists()
|
||||
assert called.get("called") is True
|
||||
|
||||
|
||||
def test_verify_checksum_command(monkeypatch):
|
||||
called = {}
|
||||
|
||||
|
Reference in New Issue
Block a user