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

Function writeStoreForClientTest

internal/cli/env_token_test.go:48–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func writeStoreForClientTest(t *testing.T) {
49 t.Helper()
50 home := setTempHome(t)
51 dir := filepath.Join(home, ".pad")
52 if err := os.MkdirAll(dir, 0755); err != nil {
53 t.Fatalf("mkdir: %v", err)
54 }
55 body := `{"version": 2, "credentials": {"http://127.0.0.1:7777": {
56 "server_url": "http://127.0.0.1:7777", "token": "padsess_fromstore",
57 "user_id": "u-1", "email": "a@b.c", "name": "A"}}}`
58 if err := os.WriteFile(filepath.Join(dir, "credentials.json"), []byte(body), 0600); err != nil {
59 t.Fatalf("write: %v", err)
60 }
61}
62
63// PAD_TOKEN must beat the stored credential: the env var is the caller's
64// explicit, per-process choice; the file is ambient machine state.

Calls 4

setTempHomeFunction · 0.85
HelperMethod · 0.80
JoinMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected