test: add integration tests for GET /issues/new and GET /issues/new/labels handlers #138
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
NewIssuehandler (GET/issues/new) renders the create-issue form with a repo selector and label multi-select populated from the Gitea API. TheNewIssueLabelshandler (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
TestNewIssue_NoToken— verify redirect to/settingswhen cookie is absent.TestNewIssue_WithToken— mock Gitea API forListOrgsAndRepos; assert form is rendered with repo selector.TestNewIssueLabels_WithRepo— mockGetRepoLabels; assert label options are returned as HTML fragment.TestNewIssueLabels_MissingRepo— assert graceful 400 response whenorgorrepoparam is missing.Acceptance criteria
go test ./internal/handlers/...passes.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.