From 24e3bb54db579fb9aad8df2a591527dc77fe4cb4 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 1 Nov 2026 19:19:49 +0100 Subject: 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). --- tests/storage.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/storage.rs') diff --git a/tests/storage.rs b/tests/storage.rs index e6ad2d1..21e76d4 100644 --- a/tests/storage.rs +++ b/tests/storage.rs @@ -88,6 +88,27 @@ fn forgetting_one_address_keeps_the_shared_credentials() { assert_eq!(client_database::get_credentials(&conn, "server-a"), None); } +#[test] +fn forgetting_the_login_keeps_the_trusted_key() { + let (_, conn) = tmp_db("creds-forget-login"); + client_database::init_db(&conn); + + client_database::save_host(&conn, "127.0.0.1:11525"); + client_database::save_fingerprint(&conn, "127.0.0.1:11525", "server-a").unwrap(); + client_database::save_credentials(&conn, "server-a", "alice", "pw").unwrap(); + + assert!(client_database::forget_credentials(&conn, "server-a").unwrap()); + assert_eq!(client_database::get_credentials(&conn, "server-a"), None); + assert_eq!( + client_database::get_fingerprint(&conn, "127.0.0.1:11525"), + Some("server-a".to_string()), + "forgetting the login must not unpin the key" + ); + + // A second call is a no-op, not an error. + assert!(!client_database::forget_credentials(&conn, "server-a").unwrap()); +} + #[test] fn client_last_host_tracking() { let (_, conn) = tmp_db("hosts"); -- cgit v1.2.3