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

Function TestRunBrowserBootstrap_OpenMode

internal/cli/bootstrap_test.go:116–137  ·  view source on GitHub ↗

TestRunBrowserBootstrap_OpenMode covers PAD_BYPASS_SETUP_TOKEN=true: no token file required, helper should still print a /setup URL and poll to completion.

(t *testing.T)

Source from the content-addressed store, hash-verified

114// no token file required, helper should still print a /setup URL and
115// poll to completion.
116func TestRunBrowserBootstrap_OpenMode(t *testing.T) {
117 withFastPolling(t, 10*time.Millisecond, 5*time.Second)
118
119 var calls atomic.Int32
120 srv := fakeSessionServer(t, func() SessionResponse {
121 n := calls.Add(1)
122 if n <= 2 {
123 return SessionResponse{SetupRequired: true, SetupMethod: "open"}
124 }
125 return SessionResponse{SetupRequired: false}
126 })
127 cfg := newTestConfig(t, srv.URL)
128 // Deliberately no token file — open mode shouldn't need one.
129
130 client := NewClientFromURL(srv.URL)
131 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
132 defer cancel()
133
134 if err := RunBrowserBootstrap(ctx, client, cfg, ""); err != nil {
135 t.Fatalf("RunBrowserBootstrap (open mode): %v", err)
136 }
137}
138
139// TestRunBrowserBootstrap_TokenMissing — server says setup_method=logs_token
140// but the file isn't on disk. Helper should fail loudly with a path-aware

Callers

nothing calls this directly

Calls 6

withFastPollingFunction · 0.85
fakeSessionServerFunction · 0.85
NewClientFromURLFunction · 0.85
RunBrowserBootstrapFunction · 0.85
newTestConfigFunction · 0.70
cancelFunction · 0.50

Tested by

no test coverage detected