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

Function TestFetchModelsFromURL_MalformedJSON

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

Source from the content-addressed store, hash-verified

207}
208
209func TestFetchModelsFromURL_MalformedJSON(t *testing.T) {
210 t.Parallel()
211
212 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
213 w.Header().Set("Content-Type", "application/json")
214 _, err := w.Write([]byte(`not json`))
215 assert.NoError(t, err)
216 }))
217 t.Cleanup(server.Close)
218
219 models := fetchModelsFromURL(t.Context(), server.URL+"/v1/models", server.Client())
220 assert.Empty(t, models)
221}
222
223func TestFetchModelsFromURL_EmptyBody(t *testing.T) {
224 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