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

Function TestSessionCreate

server/server_test.go:303–323  ·  view source on GitHub ↗

Session Handler Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

301// Session Handler Tests
302
303func 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
325func TestSessionList(t *testing.T) {
326 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