Session Handler Tests
(t *testing.T)
| 301 | // Session Handler Tests |
| 302 | |
| 303 | func TestSessionCreate(t *testing.T) { |
| 304 | srv, cleanup := setupTestServer(t) |
| 305 | defer cleanup() |
| 306 | |
| 307 | body := `{ |
| 308 | "agent_id": "test-agent", |
| 309 | "context": { |
| 310 | "user_id": "user-123" |
| 311 | } |
| 312 | }` |
| 313 | |
| 314 | req := httptest.NewRequest(http.MethodPost, "/v1/sessions", strings.NewReader(body)) |
| 315 | req.Header.Set("Content-Type", "application/json") |
| 316 | w := httptest.NewRecorder() |
| 317 | |
| 318 | srv.Router().ServeHTTP(w, req) |
| 319 | |
| 320 | assert.Equal(t, http.StatusCreated, w.Code) |
| 321 | assert.Contains(t, w.Body.String(), "success") |
| 322 | assert.Contains(t, w.Body.String(), "test-agent") |
| 323 | } |
| 324 | |
| 325 | func TestSessionList(t *testing.T) { |
| 326 | srv, cleanup := setupTestServer(t) |
nothing calls this directly
no test coverage detected