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

Function TestAgentCreate

server/server_test.go:148–170  ·  view source on GitHub ↗

Agent Handler Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

146// Agent Handler Tests
147
148func TestAgentCreate(t *testing.T) {
149 srv, cleanup := setupTestServer(t)
150 defer cleanup()
151
152 body := `{
153 "template_id": "chat",
154 "name": "Test Agent",
155 "model_config": {
156 "provider": "mock",
157 "model": "test-model"
158 }
159 }`
160
161 req := httptest.NewRequest(http.MethodPost, "/v1/agents", strings.NewReader(body))
162 req.Header.Set("Content-Type", "application/json")
163 w := httptest.NewRecorder()
164
165 srv.Router().ServeHTTP(w, req)
166
167 assert.Equal(t, http.StatusCreated, w.Code)
168 assert.Contains(t, w.Body.String(), "success")
169 assert.Contains(t, w.Body.String(), "id")
170}
171
172func TestAgentList(t *testing.T) {
173 srv, cleanup := setupTestServer(t)

Callers

nothing calls this directly

Calls 5

setupTestServerFunction · 0.85
SetMethod · 0.65
ServeHTTPMethod · 0.45
RouterMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected