mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 00:09:04 +00:00
Add change-password command and endpoint
This commit is contained in:
@@ -158,6 +158,19 @@ def test_update_config(client):
|
||||
assert res.headers.get("access-control-allow-origin") == "http://example.com"
|
||||
|
||||
|
||||
def test_change_password_route(client):
|
||||
cl, token = client
|
||||
called = {}
|
||||
|
||||
api._pm.change_password = lambda: called.setdefault("called", True)
|
||||
headers = {"Authorization": f"Bearer {token}", "Origin": "http://example.com"}
|
||||
res = cl.post("/api/v1/change-password", headers=headers)
|
||||
assert res.status_code == 200
|
||||
assert res.json() == {"status": "ok"}
|
||||
assert called.get("called") is True
|
||||
assert res.headers.get("access-control-allow-origin") == "http://example.com"
|
||||
|
||||
|
||||
def test_update_config_unknown_key(client):
|
||||
cl, token = client
|
||||
headers = {"Authorization": f"Bearer {token}", "Origin": "http://example.com"}
|
||||
@@ -206,6 +219,7 @@ def test_shutdown(client, monkeypatch):
|
||||
("put", "/api/v1/config/inactivity_timeout"),
|
||||
("post", "/api/v1/entry/1/archive"),
|
||||
("post", "/api/v1/entry/1/unarchive"),
|
||||
("post", "/api/v1/change-password"),
|
||||
],
|
||||
)
|
||||
def test_invalid_token_other_endpoints(client, method, path):
|
||||
|
@@ -81,6 +81,19 @@ def test_vault_export(monkeypatch, tmp_path):
|
||||
assert called["path"] == out_path
|
||||
|
||||
|
||||
def test_vault_change_password(monkeypatch):
|
||||
called = {}
|
||||
|
||||
def change_pw():
|
||||
called["called"] = True
|
||||
|
||||
pm = SimpleNamespace(change_password=change_pw, select_fingerprint=lambda fp: None)
|
||||
monkeypatch.setattr(cli, "PasswordManager", lambda: pm)
|
||||
result = runner.invoke(app, ["vault", "change-password"])
|
||||
assert result.exit_code == 0
|
||||
assert called.get("called") is True
|
||||
|
||||
|
||||
def test_nostr_get_pubkey(monkeypatch):
|
||||
pm = SimpleNamespace(
|
||||
nostr_client=SimpleNamespace(
|
||||
|
Reference in New Issue
Block a user