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

Function TestFetchModelsFromURL_EmptyIDs

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

Source from the content-addressed store, hash-verified

265}
266
267func TestFetchModelsFromURL_EmptyIDs(t *testing.T) {
268 t.Parallel()
269
270 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
271 w.Header().Set("Content-Type", "application/json")
272 _, err := w.Write([]byte(`{"object":"list","data":[
273 {"id":""},
274 {"id":"valid"},
275 {"id":""}
276 ]}`))
277 assert.NoError(t, err)
278 }))
279 t.Cleanup(server.Close)
280
281 models := fetchModelsFromURL(t.Context(), server.URL+"/v1/models", server.Client())
282 assert.Equal(t, []string{"valid"}, models)
283}
284
285func TestFetchModelsFromURL_ContextCanceled(t *testing.T) {
286 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