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

Function TestHandleAgentActivity_EmptyActivity

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

Source from the content-addressed store, hash-verified

89}
90
91func TestHandleAgentActivity_EmptyActivity(t *testing.T) {
92 ua, store, token := setupUserAuth(t)
93 ctx := context.Background()
94
95 user, _ := store.GetUserSession(ctx, token)
96 store.ClaimOrCreateDomain(ctx, "empty-activity.example.com", user.ID)
97 store.CreateAgent(ctx, "agent@empty-activity.example.com", "empty-activity.example.com", "", "https://example.com/webhook", "", user.ID)
98
99 req := authedRequest("GET", "/api/dashboard/agents/agent%40empty-activity.example.com/activity", token)
100 w := httptest.NewRecorder()
101 ua.HandleAgentActivity(w, req)
102
103 if w.Code != http.StatusOK {
104 t.Fatalf("status = %d, want 200", w.Code)
105 }
106
107 var activity []identity.Message
108 json.NewDecoder(w.Body).Decode(&activity)
109 if len(activity) != 0 {
110 t.Errorf("expected empty activity, got %d", len(activity))
111 }
112}
113
114func TestHandleAgentActivity_WithMessages(t *testing.T) {
115 ua, store, token := setupUserAuth(t)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected