summaryrefslogtreecommitdiffstats
path: root/tests/storage.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
commit24e3bb54db579fb9aad8df2a591527dc77fe4cb4 (patch)
treeaf9a0c290f2675068e8396823f641f24bbe4d308 /tests/storage.rs
parentv4.0.6: move the prompt editor and key mapping out of the core (diff)
downloadzagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.tar.gz
zagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.zip
v4.0.7: finish the Phase 1 boundary with a command shell
The terminal command line moves to client::shell: a typed line becomes a core Command or an adapter action (connect, login, register, set-credential, host maintenance). ClientCore loses submit_line and the last TUI-shaped effects (Interactive, SetPrompt, ListHosts, ForgetHost, AnimateRoulette); the adapter animates roulette from the Result view. Adds forget-login, which drops the stored credential for the pinned key and keeps trust, distinct from logout (session only) and forget-host (trust too).
Diffstat (limited to 'tests/storage.rs')
-rw-r--r--tests/storage.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/storage.rs b/tests/storage.rs
index e6ad2d1..21e76d4 100644
--- a/tests/storage.rs
+++ b/tests/storage.rs
@@ -89,6 +89,27 @@ fn forgetting_one_address_keeps_the_shared_credentials() {
89} 89}
90 90
91#[test] 91#[test]
92fn forgetting_the_login_keeps_the_trusted_key() {
93 let (_, conn) = tmp_db("creds-forget-login");
94 client_database::init_db(&conn);
95
96 client_database::save_host(&conn, "127.0.0.1:11525");
97 client_database::save_fingerprint(&conn, "127.0.0.1:11525", "server-a").unwrap();
98 client_database::save_credentials(&conn, "server-a", "alice", "pw").unwrap();
99
100 assert!(client_database::forget_credentials(&conn, "server-a").unwrap());
101 assert_eq!(client_database::get_credentials(&conn, "server-a"), None);
102 assert_eq!(
103 client_database::get_fingerprint(&conn, "127.0.0.1:11525"),
104 Some("server-a".to_string()),
105 "forgetting the login must not unpin the key"
106 );
107
108 // A second call is a no-op, not an error.
109 assert!(!client_database::forget_credentials(&conn, "server-a").unwrap());
110}
111
112#[test]
92fn client_last_host_tracking() { 113fn client_last_host_tracking() {
93 let (_, conn) = tmp_db("hosts"); 114 let (_, conn) = tmp_db("hosts");
94 client_database::init_db(&conn); 115 client_database::init_db(&conn);