TestStore_Set_AddAndReplace — Set adds a new entry on first call, replaces it on a second call with the same key. Mirrors the URL into the value's ServerURL field for consumer consistency.
(t *testing.T)
| 231 | // replaces it on a second call with the same key. Mirrors the URL into |
| 232 | // the value's ServerURL field for consumer consistency. |
| 233 | func TestStore_Set_AddAndReplace(t *testing.T) { |
| 234 | store := newEmptyStore() |
| 235 | store.Set("http://x:7777", &Credentials{Token: "first", Email: "a@a"}) |
| 236 | store.Set("http://x:7777", &Credentials{Token: "second", Email: "b@b"}) |
| 237 | |
| 238 | got := store.Get("http://x:7777") |
| 239 | if got == nil { |
| 240 | t.Fatal("Get returned nil after Set") |
| 241 | } |
| 242 | if got.Token != "second" { |
| 243 | t.Errorf("token = %q, want second (replace failed)", got.Token) |
| 244 | } |
| 245 | if got.Email != "b@b" { |
| 246 | t.Errorf("email = %q, want b@b", got.Email) |
| 247 | } |
| 248 | // Set must mirror the URL into the value's ServerURL field. |
| 249 | if got.ServerURL != "http://x:7777" { |
| 250 | t.Errorf("ServerURL on stored value = %q, want http://x:7777", got.ServerURL) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // TestStore_Delete_KeepsSiblings — Delete removes only the targeted |
| 255 | // entry. This is the keystone behavior of TASK-1228: `pad auth logout` |
nothing calls this directly
no test coverage detected