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

Function TestProtectionPutRequiresTopLevelKeys

internal/httpapi/protection_test.go:99–110  ·  view source on GitHub ↗

TestProtectionPutRequiresTopLevelKeys: a body missing a top-level section is a 422 (D3 — no silent reset).

(t *testing.T)

Source from the content-addressed store, hash-verified

97// TestProtectionPutRequiresTopLevelKeys: a body missing a top-level section is a
98// 422 (D3 — no silent reset).
99func TestProtectionPutRequiresTopLevelKeys(t *testing.T) {
100 srv, _ := protectionServer(t)
101 // Missing "holds".
102 put := map[string]any{
103 "inbound": map[string]any{"gate": map[string]any{}, "scan": map[string]any{}},
104 "outbound": map[string]any{"gate": map[string]any{}, "scan": map[string]any{}},
105 }
106 code, body := sendJSON(t, "PUT", srv.URL+"/v1/agents/support%40acme.com/protection", "good", put)
107 if code != 422 {
108 t.Fatalf("missing holds: status %d, want 422 (body %v)", code, body)
109 }
110}
111
112// TestProtectionPutEmptyLeavesDefault: present top-level keys with empty leaves
113// fill the safe-permissive defaults.

Callers

nothing calls this directly

Calls 2

protectionServerFunction · 0.85
sendJSONFunction · 0.85

Tested by

no test coverage detected