MCPcopy Index your code
hub / github.com/docker/docker-agent / TestExecutePreToolUseWithEchoCommand

Function TestExecutePreToolUseWithEchoCommand

pkg/hooks/hooks_test.go:353–377  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

351}
352
353func TestExecutePreToolUseWithEchoCommand(t *testing.T) {
354 t.Parallel()
355
356 config := &Config{
357 PreToolUse: []MatcherConfig{
358 {
359 Matcher: "*",
360 Hooks: []Hook{
361 {Type: HookTypeCommand, Command: "echo 'test'", Timeout: 5},
362 },
363 },
364 },
365 }
366
367 exec := NewExecutor(config, t.TempDir(), nil)
368 input := &Input{
369 SessionID: "test-session",
370 ToolName: "shell",
371 ToolUseID: "test-id",
372 }
373
374 result, err := exec.Dispatch(t.Context(), EventPreToolUse, input)
375 require.NoError(t, err)
376 assert.True(t, result.Allowed)
377}
378
379func TestExecutePreToolUseBlockingExitCode(t *testing.T) {
380 t.Parallel()

Callers

nothing calls this directly

Calls 3

DispatchMethod · 0.95
NewExecutorFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected