MCPcopy Create free account
hub / github.com/bodaay/HuggingFaceModelDownloader / TestAPI_ListJobs

Function TestAPI_ListJobs

internal/server/api_test.go:266–292  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

264}
265
266func TestAPI_ListJobs(t *testing.T) {
267 srv := newTestServer()
268
269 // Create a job first
270 body := `{"repo": "list/test"}`
271 req := httptest.NewRequest("POST", "/api/download", bytes.NewBufferString(body))
272 req.Header.Set("Content-Type", "application/json")
273 w := httptest.NewRecorder()
274 srv.handleStartDownload(w, req)
275
276 // List jobs
277 listReq := httptest.NewRequest("GET", "/api/jobs", nil)
278 listW := httptest.NewRecorder()
279 srv.handleListJobs(listW, listReq)
280
281 if listW.Code != http.StatusOK {
282 t.Errorf("Expected 200, got %d", listW.Code)
283 }
284
285 var resp map[string]any
286 json.Unmarshal(listW.Body.Bytes(), &resp)
287
288 count := int(resp["count"].(float64))
289 if count < 1 {
290 t.Error("Expected at least 1 job")
291 }
292}
293
294func TestAPI_ParseFiltersFromRepo(t *testing.T) {
295 srv := newTestServer()

Callers

nothing calls this directly

Calls 4

newTestServerFunction · 0.85
handleStartDownloadMethod · 0.80
handleListJobsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected