MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / TestWipeCredentialsFile

Function TestWipeCredentialsFile

internal/cli/credentials_test.go:374–388  ·  view source on GitHub ↗

TestWipeCredentialsFile — removes the file entirely. Distinct from CredentialStore.Delete (which removes one entry). Idempotent.

(t *testing.T)

Source from the content-addressed store, hash-verified

372// TestWipeCredentialsFile — removes the file entirely. Distinct from
373// CredentialStore.Delete (which removes one entry). Idempotent.
374func 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

Callers

nothing calls this directly

Calls 5

withTempHomeFunction · 0.85
writeCredsFileFunction · 0.85
WipeCredentialsFileFunction · 0.85
JoinMethod · 0.80
StatMethod · 0.65

Tested by

no test coverage detected