MCPcopy
hub / github.com/docker/docker-agent / TestElicitationAutoDeclineInJSONMode

Function TestElicitationAutoDeclineInJSONMode

pkg/cli/runner_test.go:266–291  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

264}
265
266func TestElicitationAutoDeclineInJSONMode(t *testing.T) {
267 t.Parallel()
268
269 rt := &mockRuntime{
270 events: []runtime.Event{
271 &runtime.ElicitationRequestEvent{
272 Type: "elicitation_request",
273 Message: "Please authorize",
274 Meta: map[string]any{"docker-agent/server_url": "https://example.com"},
275 },
276 },
277 }
278
279 var buf bytes.Buffer
280 out := NewPrinter(&buf)
281 sess := session.New()
282 cfg := Config{OutputJSON: true}
283
284 err := Run(t.Context(), out, cfg, rt, sess, []string{"hello"})
285 assert.NilError(t, err)
286
287 rt.mu.Lock()
288 defer rt.mu.Unlock()
289 assert.Equal(t, rt.elicitationDeclines, 1)
290 assert.Equal(t, rt.elicitationLastAction, tools.ElicitationAction("decline"))
291}
292
293func TestMaxIterationsSafetyCapJSONMode(t *testing.T) {
294 t.Parallel()

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
ElicitationActionTypeAlias · 0.92
NewPrinterFunction · 0.85
ContextMethod · 0.80
RunFunction · 0.70
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected