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

Function TestAPITool_GET

pkg/tools/builtin/api/api_test.go:67–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestAPITool_GET(t *testing.T) {
68 t.Parallel()
69 ts := getTestServer(t)
70
71 tool := newAPIToolForTest(latest.APIToolConfig{
72 Method: http.MethodGet,
73 Endpoint: ts.serverURL + "/api?key=${key}&value=${value}",
74 }, testExpander())
75
76 result, err := tool.callTool(t.Context(), tools.ToolCall{
77 Function: tools.FunctionCall{
78 Arguments: `{"key": "mykey", "value": "myvalue"}`,
79 },
80 })
81
82 require.NoError(t, err)
83 assert.JSONEq(t, `{"status":"ok"}`, result.Output)
84 assert.Equal(t, http.MethodGet, ts.receivedMethod)
85 assert.Equal(t, "/api?key=mykey&value=myvalue", ts.receivedURL)
86}
87
88func TestAPITool_POST(t *testing.T) {
89 t.Parallel()

Callers

nothing calls this directly

Calls 5

getTestServerFunction · 0.85
newAPIToolForTestFunction · 0.85
testExpanderFunction · 0.85
ContextMethod · 0.80
callToolMethod · 0.45

Tested by

no test coverage detected