MCPcopy Create free account
hub / github.com/astercloud/aster / TestQueryParameters

Function TestQueryParameters

server/handlers_test.go:480–501  ·  view source on GitHub ↗

TestQueryParameters 测试查询参数

(t *testing.T)

Source from the content-addressed store, hash-verified

478
479// TestQueryParameters 测试查询参数
480func 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 测试响应格式
504func TestResponseFormat(t *testing.T) {

Callers

nothing calls this directly

Calls 4

setupTestServerFunction · 0.85
RunMethod · 0.45
ServeHTTPMethod · 0.45
RouterMethod · 0.45

Tested by

no test coverage detected