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

Function TestHandleAgentActivity_NotOwned

internal/auth/auth_test.go:73–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestHandleAgentActivity_NotOwned(t *testing.T) {
74 ua, store, token := setupUserAuth(t)
75 ctx := context.Background()
76
77 // Create agent owned by a different user (not the authenticated user)
78 otherUser, _ := store.CreateOrGetUser(ctx, "other@example.com", "Other", "google-other")
79 store.ClaimOrCreateDomain(ctx, "unowned.example.com", otherUser.ID)
80 store.CreateAgent(ctx, "agent@unowned.example.com", "unowned.example.com", "", "https://example.com/webhook", "", otherUser.ID)
81
82 req := authedRequest("GET", "/api/dashboard/agents/agent%40unowned.example.com/activity", token)
83 w := httptest.NewRecorder()
84 ua.HandleAgentActivity(w, req)
85
86 if w.Code != http.StatusNotFound {
87 t.Errorf("status = %d, want 404 for unowned agent", w.Code)
88 }
89}
90
91func TestHandleAgentActivity_EmptyActivity(t *testing.T) {
92 ua, store, token := setupUserAuth(t)

Callers

nothing calls this directly

Calls 6

setupUserAuthFunction · 0.85
authedRequestFunction · 0.85
CreateOrGetUserMethod · 0.80
ClaimOrCreateDomainMethod · 0.80
CreateAgentMethod · 0.80
HandleAgentActivityMethod · 0.80

Tested by

no test coverage detected