(t *testing.T)
| 71 | } |
| 72 | |
| 73 | func 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 | |
| 91 | func TestHandleAgentActivity_EmptyActivity(t *testing.T) { |
| 92 | ua, store, token := setupUserAuth(t) |
nothing calls this directly
no test coverage detected