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

Function TestFetchModelsFromURL_DuplicateIDs

cmd/root/models_test.go:249–265  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestFetchModelsFromURL_DuplicateIDs(t *testing.T) {
250 t.Parallel()
251
252 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
253 w.Header().Set("Content-Type", "application/json")
254 _, err := w.Write([]byte(`{"object":"list","data":[
255 {"id":"dup"},
256 {"id":"dup"},
257 {"id":"unique"}
258 ]}`))
259 assert.NoError(t, err)
260 }))
261 t.Cleanup(server.Close)
262
263 models := fetchModelsFromURL(t.Context(), server.URL+"/v1/models", server.Client())
264 assert.Equal(t, []string{"dup", "dup", "unique"}, models)
265}
266
267func TestFetchModelsFromURL_EmptyIDs(t *testing.T) {
268 t.Parallel()

Callers

nothing calls this directly

Calls 5

fetchModelsFromURLFunction · 0.85
ContextMethod · 0.80
CleanupMethod · 0.65
SetMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected