TestWipeCredentialsFile — removes the file entirely. Distinct from CredentialStore.Delete (which removes one entry). Idempotent.
(t *testing.T)
| 372 | // TestWipeCredentialsFile — removes the file entirely. Distinct from |
| 373 | // CredentialStore.Delete (which removes one entry). Idempotent. |
| 374 | func TestWipeCredentialsFile(t *testing.T) { |
| 375 | home := withTempHome(t) |
| 376 | writeCredsFile(t, home, `{"version": 2, "credentials": {}}`) |
| 377 | |
| 378 | if err := WipeCredentialsFile(); err != nil { |
| 379 | t.Fatalf("WipeCredentialsFile: %v", err) |
| 380 | } |
| 381 | if _, err := os.Stat(filepath.Join(home, ".pad", "credentials.json")); !os.IsNotExist(err) { |
| 382 | t.Errorf("credentials.json still exists after Wipe; stat err=%v", err) |
| 383 | } |
| 384 | // Idempotent — second wipe on absent file must succeed. |
| 385 | if err := WipeCredentialsFile(); err != nil { |
| 386 | t.Errorf("WipeCredentialsFile (second call): %v", err) |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | // TestLoadStore_GarbageFileErrors — a malformed credentials.json is |
| 391 | // reported as an error, not silently treated as empty. We don't want |
nothing calls this directly
no test coverage detected