Memory Handler Tests
(t *testing.T)
| 264 | // Memory Handler Tests |
| 265 | |
| 266 | func 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 | |
| 288 | func TestMemoryListWorking(t *testing.T) { |
| 289 | srv, cleanup := setupTestServer(t) |
nothing calls this directly
no test coverage detected