TestQueryParameters 测试查询参数
(t *testing.T)
| 478 | |
| 479 | // TestQueryParameters 测试查询参数 |
| 480 | func TestQueryParameters(t *testing.T) { |
| 481 | srv, cleanup := setupTestServer(t) |
| 482 | defer cleanup() |
| 483 | |
| 484 | t.Run("ListAgentsWithPrefix", func(t *testing.T) { |
| 485 | req := httptest.NewRequest(http.MethodGet, "/v1/pool/agents?prefix=test", nil) |
| 486 | w := httptest.NewRecorder() |
| 487 | |
| 488 | srv.Router().ServeHTTP(w, req) |
| 489 | |
| 490 | assert.Equal(t, http.StatusOK, w.Code) |
| 491 | }) |
| 492 | |
| 493 | t.Run("ListWithPagination", func(t *testing.T) { |
| 494 | req := httptest.NewRequest(http.MethodGet, "/v1/agents?page=1&limit=10", nil) |
| 495 | w := httptest.NewRecorder() |
| 496 | |
| 497 | srv.Router().ServeHTTP(w, req) |
| 498 | |
| 499 | assert.Equal(t, http.StatusOK, w.Code) |
| 500 | }) |
| 501 | } |
| 502 | |
| 503 | // TestResponseFormat 测试响应格式 |
| 504 | func TestResponseFormat(t *testing.T) { |
nothing calls this directly
no test coverage detected