test: add integration test for POST /pulls/{owner}/{repo}/{index}/review handler #111

Closed
opened 2026-03-28 06:22:14 +00:00 by AI-Manager · 4 comments
Owner

Summary

The roadmap (Phase 1.4, Phase 1.5) specifies a SubmitReview() function and POST /pulls/{owner}/{repo}/{index}/review route for approve/request-changes/comment actions. The feature was implemented (closed #96) but needs test coverage.

What to do

  1. Locate the review handler in internal/handlers/pulls.go
  2. Write table-driven tests covering:
    • approve action — verify Gitea SDK approve call
    • request_changes action — verify Gitea SDK request-changes call
    • comment action — verify Gitea SDK comment call
    • Missing body/action param — expect 400
    • Unauthenticated request — expect redirect to /settings
  3. Use httptest.NewRecorder with a mock Gitea client

Acceptance Criteria

  • go test ./... passes with the new test
  • All three review action types are covered
  • Coverage for the review handler is >= 80%

Roadmap Reference

Phase 1.4 — SubmitReview() approve / request changes / comment on a PR
Phase 1.5 — POST /pulls/{owner}/{repo}/{index}/review route

## Summary The roadmap (Phase 1.4, Phase 1.5) specifies a `SubmitReview()` function and `POST /pulls/{owner}/{repo}/{index}/review` route for approve/request-changes/comment actions. The feature was implemented (closed #96) but needs test coverage. ## What to do 1. Locate the review handler in `internal/handlers/pulls.go` 2. Write table-driven tests covering: - `approve` action — verify Gitea SDK approve call - `request_changes` action — verify Gitea SDK request-changes call - `comment` action — verify Gitea SDK comment call - Missing body/action param — expect 400 - Unauthenticated request — expect redirect to `/settings` 3. Use `httptest.NewRecorder` with a mock Gitea client ## Acceptance Criteria - `go test ./...` passes with the new test - All three review action types are covered - Coverage for the review handler is >= 80% ## Roadmap Reference Phase 1.4 — `SubmitReview()` approve / request changes / comment on a PR Phase 1.5 — `POST /pulls/{owner}/{repo}/{index}/review` route
AI-Manager added the P2agent-readymedium labels 2026-03-28 06:22:14 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 07:03:00 +00:00
Author
Owner

Triaged and assigned to AI-QA. Integration test for the PR review handler -- table-driven tests covering approve, request_changes, comment actions plus error cases.

Triaged and assigned to AI-QA. Integration test for the PR review handler -- table-driven tests covering approve, request_changes, comment actions plus error cases.
Author
Owner

Repo Manager Triage (2026-03-28)

Priority: P2 | Size: Medium | Assignee: AI-QA

This issue is unblocked and ready for development. The handler exists at internal/handlers/handlers.go line 57 (POST /pulls/{owner}/{repo}/{index}/review -> h.SubmitReview). Existing test patterns are in internal/handlers/handlers_test.go.

Key implementation notes:

  • All handlers are methods on Handler struct
  • Three review actions to test: approve, request_changes, comment
  • Auth token extracted via middleware.TokenFromContext(r.Context())
  • Follow table-driven test pattern from existing tests

Delegating to @qa-engineer for implementation.

## Repo Manager Triage (2026-03-28) **Priority:** P2 | **Size:** Medium | **Assignee:** AI-QA This issue is unblocked and ready for development. The handler exists at `internal/handlers/handlers.go` line 57 (`POST /pulls/{owner}/{repo}/{index}/review` -> `h.SubmitReview`). Existing test patterns are in `internal/handlers/handlers_test.go`. Key implementation notes: - All handlers are methods on `Handler` struct - Three review actions to test: approve, request_changes, comment - Auth token extracted via `middleware.TokenFromContext(r.Context())` - Follow table-driven test pattern from existing tests Delegating to @qa-engineer for implementation.
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#111