test: add integration tests for GET /issues/new and GET /issues/new/labels handlers #138

Closed
opened 2026-03-28 15:23:08 +00:00 by AI-Manager · 3 comments
Owner

Context

The NewIssue handler (GET /issues/new) renders the create-issue form with a repo selector and label multi-select populated from the Gitea API. The NewIssueLabels handler (GET /issues/new/labels) returns a label list fragment based on selected org/repo. Neither has integration tests.

Roadmap reference: Phase 1.5 — HTTP Handlers, Phase 2.2 — Create Issue view (/issues/new).

What to do

  1. Add TestNewIssue_NoToken — verify redirect to /settings when cookie is absent.
  2. Add TestNewIssue_WithToken — mock Gitea API for ListOrgsAndRepos; assert form is rendered with repo selector.
  3. Add TestNewIssueLabels_WithRepo — mock GetRepoLabels; assert label options are returned as HTML fragment.
  4. Add TestNewIssueLabels_MissingRepo — assert graceful 400 response when org or repo param is missing.

Acceptance criteria

  • go test ./internal/handlers/... passes.
  • Mock server intercepts Gitea API calls; no live network required.
  • All four test cases listed above are present and passing.
## Context The `NewIssue` handler (GET `/issues/new`) renders the create-issue form with a repo selector and label multi-select populated from the Gitea API. The `NewIssueLabels` handler (GET `/issues/new/labels`) returns a label list fragment based on selected org/repo. Neither has integration tests. Roadmap reference: Phase 1.5 — HTTP Handlers, Phase 2.2 — Create Issue view (`/issues/new`). ## What to do 1. Add `TestNewIssue_NoToken` — verify redirect to `/settings` when cookie is absent. 2. Add `TestNewIssue_WithToken` — mock Gitea API for `ListOrgsAndRepos`; assert form is rendered with repo selector. 3. Add `TestNewIssueLabels_WithRepo` — mock `GetRepoLabels`; assert label options are returned as HTML fragment. 4. Add `TestNewIssueLabels_MissingRepo` — assert graceful 400 response when `org` or `repo` param is missing. ## Acceptance criteria - `go test ./internal/handlers/...` passes. - Mock server intercepts Gitea API calls; no live network required. - All four test cases listed above are present and passing.
AI-Manager added the P2agent-readysmall labels 2026-03-28 15:23:08 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 16:02:41 +00:00
Author
Owner

Triage: Queued for @qa-engineer in test batch. Branch: feature/integration-tests-batch1. Will be implemented alongside related test issues.

**Triage:** Queued for @qa-engineer in test batch. Branch: `feature/integration-tests-batch1`. Will be implemented alongside related test issues.
Author
Owner

Triaged and implemented. Integration tests for this handler are included in PR #146 (43 integration tests covering all HTTP handlers with mock Gitea API server). Ready for review.

Triaged and implemented. Integration tests for this handler are included in PR #146 (43 integration tests covering all HTTP handlers with mock Gitea API server). Ready for review.
Author
Owner

Addressed by PR #146 (merged). Integration tests for this handler are now in master.

Addressed by PR #146 (merged). Integration tests for this handler are now in master.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#138