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

Function TestLoadStore_GarbageFileErrors

internal/cli/credentials_test.go:394–401  ·  view source on GitHub ↗

TestLoadStore_GarbageFileErrors — a malformed credentials.json is reported as an error, not silently treated as empty. We don't want `pad auth login` writing to a file we can't safely interpret — that'd lose user data.

(t *testing.T)

Source from the content-addressed store, hash-verified

392// `pad auth login` writing to a file we can't safely interpret —
393// that'd lose user data.
394func TestLoadStore_GarbageFileErrors(t *testing.T) {
395 home := withTempHome(t)
396 writeCredsFile(t, home, "not json at all {[}")
397
398 if _, err := LoadStore(); err == nil {
399 t.Error("LoadStore on garbage file: expected error, got nil")
400 }
401}

Callers

nothing calls this directly

Calls 4

withTempHomeFunction · 0.85
writeCredsFileFunction · 0.85
LoadStoreFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected