(t *testing.T)
| 233 | } |
| 234 | |
| 235 | func TestHookRunsHandlerRejectsInvalidEvent(t *testing.T) { |
| 236 | t.Parallel() |
| 237 | |
| 238 | homePaths := newTestHomePaths(t) |
| 239 | manager := stubSessionManager{ |
| 240 | StatusFn: func(_ context.Context, id string) (*session.Info, error) { |
| 241 | return newSessionInfo(id), nil |
| 242 | }, |
| 243 | } |
| 244 | |
| 245 | engine := newTestRouter(t, newTestHandlers(t, manager, stubObserver{}, homePaths)) |
| 246 | recorder := performRequest( |
| 247 | t, |
| 248 | engine, |
| 249 | http.MethodGet, |
| 250 | "/api/workspaces/ws-workspace/hooks/runs?session=sess-hook&event=not-a-hook", |
| 251 | nil, |
| 252 | ) |
| 253 | if recorder.Code != http.StatusBadRequest { |
| 254 | t.Fatalf("status = %d, want %d; body=%s", recorder.Code, http.StatusBadRequest, recorder.Body.String()) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | func TestHookCatalogHandlerRejectsInvalidSource(t *testing.T) { |
| 259 | t.Parallel() |
nothing calls this directly
no test coverage detected