Document integration steps and add SSH/seed UI

This commit is contained in:
thePR0M3TH3AN
2025-07-04 17:25:02 -04:00
parent 92a4822355
commit b176486ca7
11 changed files with 161 additions and 18 deletions

View File

@@ -24,7 +24,13 @@ def test_backup_restore_workflow(monkeypatch):
data1 = {
"schema_version": 2,
"entries": {
"0": {"website": "a", "length": 10, "type": "password", "notes": ""}
"0": {
"website": "a",
"length": 10,
"type": "password",
"kind": "password",
"notes": "",
}
},
}
vault.save_index(data1)
@@ -39,7 +45,13 @@ def test_backup_restore_workflow(monkeypatch):
data2 = {
"schema_version": 2,
"entries": {
"0": {"website": "b", "length": 12, "type": "password", "notes": ""}
"0": {
"website": "b",
"length": 12,
"type": "password",
"kind": "password",
"notes": "",
}
},
}
vault.save_index(data2)

View File

@@ -77,7 +77,7 @@ def test_out_of_range_menu(monkeypatch, capsys):
def test_invalid_add_entry_submenu(monkeypatch, capsys):
called = {"add": False, "retrieve": False, "modify": False}
pm, _ = _make_pm(called)
inputs = iter(["1", "4", "3", "7"])
inputs = iter(["1", "6", "5", "7"])
monkeypatch.setattr(main, "timed_input", lambda *_: next(inputs))
monkeypatch.setattr("builtins.input", lambda *_: next(inputs))
with pytest.raises(SystemExit):

View File

@@ -31,6 +31,7 @@ def test_add_and_retrieve_entry():
"url": "",
"blacklisted": False,
"type": "password",
"kind": "password",
"notes": "",
}
@@ -70,8 +71,10 @@ def test_round_trip_entry_types(method, expected_type):
entry = entry_mgr.retrieve_entry(index)
assert entry["type"] == expected_type
assert entry["kind"] == expected_type
data = enc_mgr.load_json_data(entry_mgr.index_file)
assert data["entries"][str(index)]["type"] == expected_type
assert data["entries"][str(index)]["kind"] == expected_type
def test_legacy_entry_defaults_to_password():

View File

@@ -58,6 +58,7 @@ def test_handle_add_totp(monkeypatch, capsys):
entry = entry_mgr.retrieve_entry(0)
assert entry == {
"type": "totp",
"kind": "totp",
"label": "Example",
"index": 0,
"period": 30,

View File

@@ -22,7 +22,7 @@ def test_add_and_retrieve_ssh_key_pair():
index = entry_mgr.add_ssh_key(TEST_SEED)
entry = entry_mgr.retrieve_entry(index)
assert entry == {"type": "ssh", "index": index, "notes": ""}
assert entry == {"type": "ssh", "kind": "ssh", "index": index, "notes": ""}
priv1, pub1 = entry_mgr.get_ssh_key_pair(index, TEST_SEED)
priv2, pub2 = entry_mgr.get_ssh_key_pair(index, TEST_SEED)

View File

@@ -30,6 +30,7 @@ def test_add_totp_and_get_code():
entry = entry_mgr.retrieve_entry(0)
assert entry == {
"type": "totp",
"kind": "totp",
"label": "Example",
"index": 0,
"period": 30,
@@ -66,6 +67,7 @@ def test_add_totp_imported(tmp_path):
entry = em.retrieve_entry(0)
assert entry == {
"type": "totp",
"kind": "totp",
"label": "Imported",
"secret": secret,
"period": 30,