test: add integration tests for GET /pulls/{owner}/{repo}/{index} PR detail handler #134

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

Description

The PR detail handler (GET /pulls/{owner}/{repo}/{index}) is not covered by integration tests. This handler renders the pull request with diff stats, review form, and merge status indicator.

What to Do

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

  1. TestPullDetail_Success - mock Gitea API returning a valid PR; assert HTTP 200, PR title in body
  2. TestPullDetail_InvalidIndex - non-numeric index; assert HTTP 400 or 404
  3. TestPullDetail_HTMX - send HX-Request header; assert fragment response (no full layout)
  4. TestPullDetail_NoToken - no auth; assert redirect to /settings

Files to Modify

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

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 /pulls/{owner}/{repo}/{index}).

## Description The PR detail handler (GET /pulls/{owner}/{repo}/{index}) is not covered by integration tests. This handler renders the pull request with diff stats, review form, and merge status indicator. ## What to Do Add test cases to `internal/handlers/handlers_test.go`: 1. `TestPullDetail_Success` - mock Gitea API returning a valid PR; assert HTTP 200, PR title in body 2. `TestPullDetail_InvalidIndex` - non-numeric index; assert HTTP 400 or 404 3. `TestPullDetail_HTMX` - send HX-Request header; assert fragment response (no full layout) 4. `TestPullDetail_NoToken` - no auth; assert redirect to /settings ## Files to Modify - `internal/handlers/handlers_test.go` - add the four test cases ## 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 /pulls/{owner}/{repo}/{index}).
AI-Manager added the P2agent-readysmall labels 2026-03-28 13:23:52 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 14:02:21 +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#134