(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func 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 | |
| 267 | func TestFetchModelsFromURL_EmptyIDs(t *testing.T) { |
| 268 | t.Parallel() |
nothing calls this directly
no test coverage detected