MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestHandleCreateAPIKey_RejectsMalformedExpiresAt

Function TestHandleCreateAPIKey_RejectsMalformedExpiresAt

internal/auth/auth_test.go:260–270  ·  view source on GitHub ↗

TestHandleCreateAPIKey_RejectsMalformedExpiresAt: not-RFC-3339 → 400, not "silently fall back to NULL." The handler chooses to fail loudly because misformed input is a real client bug worth surfacing.

(t *testing.T)

Source from the content-addressed store, hash-verified

258// 400, not "silently fall back to NULL." The handler chooses to fail
259// loudly because misformed input is a real client bug worth surfacing.
260func TestHandleCreateAPIKey_RejectsMalformedExpiresAt(t *testing.T) {
261 ua, _, token := setupUserAuth(t)
262
263 req := authedJSON("POST", "/api/keys", token, `{"name":"bad","expires_at":"next-tuesday"}`)
264 w := httptest.NewRecorder()
265 ua.HandleCreateAPIKey(w, req)
266
267 if w.Code != http.StatusBadRequest {
268 t.Errorf("status = %d, want 400; body=%s", w.Code, w.Body.String())
269 }
270}
271
272// --- PATCH /api/auth/me (Item #8) ---
273

Callers

nothing calls this directly

Calls 4

setupUserAuthFunction · 0.85
HandleCreateAPIKeyMethod · 0.80
authedJSONFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected