test: add integration tests for POST /issues/{owner}/{repo}/{index}/state and POST /pulls/{owner}/{repo}/{index}/state handlers #137
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
SetIssueStateandSetPullStatehandlers (Phase 1.5) accept astateform field and proxy it to the Gitea API. Unit tests exist only for invalid-input paths (TestSetIssueState_InvalidState,TestSetIssueState_InvalidIndex). Full round-trip tests with a mock HTTP server are missing.Roadmap reference: Phase 1.5 — HTTP Handlers (
POST /issues/{owner}/{repo}/{index}/state,POST /pulls/{owner}/{repo}/{index}/state)What to do
internal/handlers/handlers_test.go, add integration tests usinghttptest.NewServerto mock the Gitea API.SetIssueStatewith statesopenandclosed— verify correct Gitea PATCH call and redirect response.SetPullStatewith statesopenandclosed— same pattern.HX-Request: trueheader) to verify fragment response.Acceptance criteria
go test ./internal/handlers/...passes with new test cases.Triage: Queued for @qa-engineer in test batch. Branch:
feature/integration-tests-batch1. Will be implemented alongside related test issues.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.
Addressed by PR #146 (merged). Integration tests for this handler are now in master.