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

Function TestMemoryCreateWorking

server/server_test.go:266–286  ·  view source on GitHub ↗

Memory Handler Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

264// Memory Handler Tests
265
266func TestMemoryCreateWorking(t *testing.T) {
267 srv, cleanup := setupTestServer(t)
268 defer cleanup()
269
270 body := `{
271 "key": "test_key",
272 "value": "test_value",
273 "type": "string",
274 "ttl": 3600
275 }`
276
277 req := httptest.NewRequest(http.MethodPost, "/v1/memory/working", strings.NewReader(body))
278 req.Header.Set("Content-Type", "application/json")
279 w := httptest.NewRecorder()
280
281 srv.Router().ServeHTTP(w, req)
282
283 assert.Equal(t, http.StatusCreated, w.Code)
284 assert.Contains(t, w.Body.String(), "success")
285 assert.Contains(t, w.Body.String(), "test_key")
286}
287
288func TestMemoryListWorking(t *testing.T) {
289 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