TestScope_ProtectionPutIsAccountOnly: writing protection config is barred for an agent-scoped credential even on its own bound agent (#13). A valid body is sent so the request clears Huma schema validation and reaches the scope gate.
(t *testing.T)
| 127 | // an agent-scoped credential even on its own bound agent (#13). A valid body is |
| 128 | // sent so the request clears Huma schema validation and reaches the scope gate. |
| 129 | func TestScope_ProtectionPutIsAccountOnly(t *testing.T) { |
| 130 | srv := scopeTestServer(t) |
| 131 | body := map[string]any{ |
| 132 | "inbound": map[string]any{"gate": map[string]any{}, "scan": map[string]any{}}, |
| 133 | "outbound": map[string]any{"gate": map[string]any{}, "scan": map[string]any{}}, |
| 134 | "holds": map[string]any{}, |
| 135 | } |
| 136 | code, _ := sendJSON(t, "PUT", srv.URL+"/v1/agents/support%40acme.com/protection", "acct", body) |
| 137 | if code != 200 { |
| 138 | t.Errorf("account key PUT protection: status %d, want 200", code) |
| 139 | } |
| 140 | code, resp := sendJSON(t, "PUT", srv.URL+"/v1/agents/support%40acme.com/protection", "agtSupport", body) |
| 141 | if code != 403 || errCode(resp) != "forbidden" { |
| 142 | t.Errorf("agent key PUT own protection: status %d body %v, want 403 forbidden", code, resp) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // TestScope_ApproveRejectIsAccountOnly: HITL approve/reject is barred for an |
| 147 | // agent-scoped credential EVEN ON ITS OWN BOUND AGENT — self-approval would |
nothing calls this directly
no test coverage detected