Agent Handler Tests
(t *testing.T)
| 146 | // Agent Handler Tests |
| 147 | |
| 148 | func 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 | |
| 172 | func TestAgentList(t *testing.T) { |
| 173 | srv, cleanup := setupTestServer(t) |
nothing calls this directly
no test coverage detected