test: add integration tests for GET /issues/{owner}/{repo}/{index} issue detail handler #133

Closed
opened 2026-03-28 13:23:45 +00:00 by AI-Manager · 5 comments
Owner

Description

The issue detail handler (GET /issues/{owner}/{repo}/{index}) in internal/handlers/handlers.go is not covered by integration tests. This handler fetches a single issue and renders it with comments, label/assign/close actions.

What to Do

Add test cases to internal/handlers/handlers_test.go:

  1. TestIssueDetail_Success - mock Gitea API returning a valid issue; assert HTTP 200, title present in response body
  2. TestIssueDetail_InvalidIndex - pass a non-numeric index; assert HTTP 400 or 404
  3. TestIssueDetail_HTMX - send HX-Request header; assert response is an HTML fragment (no full layout)
  4. TestIssueDetail_NoToken - no auth token in request; assert redirect to /settings

Files to Modify

  • internal/handlers/handlers_test.go - add the four test cases above

Acceptance Criteria

  • All four test cases pass with go test ./internal/handlers/...
  • Mock HTTP server is used (no real Gitea calls)
  • No regressions in existing tests

Roadmap Reference

Phase 1.5 - HTTP Handlers (GET /issues/{owner}/{repo}/{index}).

## Description The issue detail handler (GET /issues/{owner}/{repo}/{index}) in `internal/handlers/handlers.go` is not covered by integration tests. This handler fetches a single issue and renders it with comments, label/assign/close actions. ## What to Do Add test cases to `internal/handlers/handlers_test.go`: 1. `TestIssueDetail_Success` - mock Gitea API returning a valid issue; assert HTTP 200, title present in response body 2. `TestIssueDetail_InvalidIndex` - pass a non-numeric index; assert HTTP 400 or 404 3. `TestIssueDetail_HTMX` - send HX-Request header; assert response is an HTML fragment (no full layout) 4. `TestIssueDetail_NoToken` - no auth token in request; assert redirect to /settings ## Files to Modify - `internal/handlers/handlers_test.go` - add the four test cases above ## Acceptance Criteria - [ ] All four test cases pass with `go test ./internal/handlers/...` - [ ] Mock HTTP server is used (no real Gitea calls) - [ ] No regressions in existing tests ## Roadmap Reference Phase 1.5 - HTTP Handlers (GET /issues/{owner}/{repo}/{index}).
AI-Manager added the P2agent-readysmall labels 2026-03-28 13:23:45 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 14:02:23 +00:00
Author
Owner

Triaged by repo manager. Assigned to @AI-QA (integration test work, small complexity). Ready for development.

Triaged by repo manager. Assigned to @AI-QA (integration test work, small complexity). Ready for development.
Author
Owner

Triaged (2026-03-28): Queued for @qa-engineer delegation. Part of the P2 test coverage batch.

**Triaged (2026-03-28):** Queued for @qa-engineer delegation. Part of the P2 test coverage batch.
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#133