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

Function TestScope_UpdateAgentIsAccountOnly

internal/httpapi/scope_test.go:112–124  ·  view source on GitHub ↗

TestScope_UpdateAgentIsAccountOnly: mutating agent config is barred for an agent-scoped credential even on its own bound agent.

(t *testing.T)

Source from the content-addressed store, hash-verified

110// TestScope_UpdateAgentIsAccountOnly: mutating agent config is barred for an
111// agent-scoped credential even on its own bound agent.
112func TestScope_UpdateAgentIsAccountOnly(t *testing.T) {
113 srv := scopeTestServer(t)
114 body := map[string]any{"name": "Renamed"}
115
116 code, _ := sendJSON(t, "PATCH", srv.URL+"/v1/agents/support%40acme.com", "acct", body)
117 if code != 200 {
118 t.Errorf("account key PATCH agent: status %d, want 200", code)
119 }
120 code, resp := sendJSON(t, "PATCH", srv.URL+"/v1/agents/support%40acme.com", "agtSupport", body)
121 if code != 403 || errCode(resp) != "forbidden" {
122 t.Errorf("agent key PATCH own agent: status %d body %v, want 403 forbidden", code, resp)
123 }
124}
125
126// TestScope_ProtectionPutIsAccountOnly: writing protection config is barred for
127// an agent-scoped credential even on its own bound agent (#13). A valid body is

Callers

nothing calls this directly

Calls 3

scopeTestServerFunction · 0.85
sendJSONFunction · 0.85
errCodeFunction · 0.85

Tested by

no test coverage detected