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

Function TestOpenAPITool_Tools

pkg/tools/builtin/openapi/openapi_test.go:125–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestOpenAPITool_Tools(t *testing.T) {
126 t.Parallel()
127
128 specServer := serveSpec(t, petStoreSpec)
129 openAPI := newOpenAPIToolForTest(specServer.URL+"/openapi.json", nil)
130
131 toolsList, err := openAPI.Tools(t.Context())
132 require.NoError(t, err)
133 assert.Len(t, toolsList, 3)
134
135 listPets := toolByName(t, toolsList, "listPets")
136 assert.Equal(t, "List all pets", listPets.Description)
137 assert.Equal(t, "openapi", listPets.Category)
138 assert.True(t, listPets.Annotations.ReadOnlyHint)
139
140 createPet := toolByName(t, toolsList, "createPet")
141 assert.Equal(t, "Create a pet", createPet.Description)
142 assert.False(t, createPet.Annotations.ReadOnlyHint)
143
144 showPet := toolByName(t, toolsList, "showPetById")
145 assert.Equal(t, "Info for a specific pet", showPet.Description)
146}
147
148func TestOpenAPITool_ToolParameters(t *testing.T) {
149 t.Parallel()

Callers

nothing calls this directly

Calls 6

serveSpecFunction · 0.85
newOpenAPIToolForTestFunction · 0.85
toolByNameFunction · 0.85
ContextMethod · 0.80
ToolsMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected