mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 00:09:04 +00:00
Add edit options for key/value entries
This commit is contained in:
@@ -218,6 +218,7 @@ def update_entry(
|
||||
label=entry.get("label"),
|
||||
period=entry.get("period"),
|
||||
digits=entry.get("digits"),
|
||||
key=entry.get("key"),
|
||||
value=entry.get("value"),
|
||||
)
|
||||
except ValueError as e:
|
||||
|
@@ -354,6 +354,7 @@ def entry_modify(
|
||||
None, "--period", help="TOTP period in seconds"
|
||||
),
|
||||
digits: Optional[int] = typer.Option(None, "--digits", help="TOTP digits"),
|
||||
key: Optional[str] = typer.Option(None, "--key", help="New key"),
|
||||
value: Optional[str] = typer.Option(None, "--value", help="New value"),
|
||||
) -> None:
|
||||
"""Modify an existing entry."""
|
||||
@@ -367,6 +368,7 @@ def entry_modify(
|
||||
label=label,
|
||||
period=period,
|
||||
digits=digits,
|
||||
key=key,
|
||||
value=value,
|
||||
)
|
||||
except ValueError as e:
|
||||
|
@@ -416,6 +416,7 @@ class EntryService:
|
||||
label: str | None = None,
|
||||
period: int | None = None,
|
||||
digits: int | None = None,
|
||||
key: str | None = None,
|
||||
value: str | None = None,
|
||||
) -> None:
|
||||
with self._lock:
|
||||
@@ -427,6 +428,7 @@ class EntryService:
|
||||
label=label,
|
||||
period=period,
|
||||
digits=digits,
|
||||
key=key,
|
||||
value=value,
|
||||
)
|
||||
self._manager.start_background_vault_sync()
|
||||
|
@@ -402,8 +402,10 @@ def test_entry_add(monkeypatch):
|
||||
def test_entry_modify(monkeypatch):
|
||||
called = {}
|
||||
|
||||
def modify_entry(index, username=None, url=None, notes=None, label=None, **kwargs):
|
||||
called["args"] = (index, username, url, notes, label, kwargs)
|
||||
def modify_entry(
|
||||
index, username=None, url=None, notes=None, label=None, key=None, **kwargs
|
||||
):
|
||||
called["args"] = (index, username, url, notes, label, key, kwargs)
|
||||
|
||||
pm = SimpleNamespace(
|
||||
entry_manager=SimpleNamespace(modify_entry=modify_entry),
|
||||
@@ -413,7 +415,7 @@ def test_entry_modify(monkeypatch):
|
||||
monkeypatch.setattr(cli, "PasswordManager", lambda: pm)
|
||||
result = runner.invoke(app, ["entry", "modify", "1", "--username", "alice"])
|
||||
assert result.exit_code == 0
|
||||
assert called["args"][:5] == (1, "alice", None, None, None)
|
||||
assert called["args"][:6] == (1, "alice", None, None, None, None)
|
||||
|
||||
|
||||
def test_entry_modify_invalid(monkeypatch):
|
||||
|
Reference in New Issue
Block a user