Skip to content

Add tests for createIssue handler - #1049

Merged
nang2049 merged 1 commit into
mattermost:masterfrom
rmdly:add-create-issue-tests
Aug 31, 2026
Merged

Add tests for createIssue handler#1049
nang2049 merged 1 commit into
mattermost:masterfrom
rmdly:add-create-issue-tests

Conversation

@rmdly

@rmdly rmdly commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #223

Adds table-driven tests for the createIssue API handler, which had no coverage.

The cases cover the request validation and permission paths that run before the GitHub API is called:

  • invalid JSON body
  • missing issue title
  • missing repo name
  • neither post_id nor channel_id supplied
  • no permission to post in the given channel
  • attached post fails to load
  • no permission to post in the attached post's channel
  • current user fails to load
  • repo not in owner/name form

Coverage of createIssue goes from 0% to 49.4%, and the package total from 40.2% to 41.1%.

Change Impact: 🟢 Low

Reasoning: The changes add isolated tests for createIssue. They do not modify production behavior or shared dependencies.

Regression Risk: Low. The tests cover validation and permission paths without changing authentication, authorization, persistence, or API contracts.

QA Recommendation: Manual QA is not required. Run the automated test suite and review test coverage results. Skipping manual QA presents low risk.

Generated by CodeRabbitAI

@rmdly
rmdly requested a review from a team as a code owner August 26, 2026 12:23
@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @rmdly,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project.

Please help complete the Mattermost contribution license agreement?
Once you have signed the CLA, please comment with /check-cla and confirm that the CLA check is green.

This is a standard procedure for many open source projects.

Please let us know if you have any questions.

We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c8b07641-a6bd-4133-b985-9f3e40bc7abd

📥 Commits

Reviewing files that changed from the base of the PR and between 3d00650 and 7238f18.

📒 Files selected for processing (1)
  • server/plugin/api_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Added table-driven tests for createIssue, covering malformed requests, required fields, permissions, lookup failures, and invalid repository formats.

Changes

Issue creation test coverage

Layer / File(s) Summary
Issue creation validation and error tests
server/plugin/api_test.go
Added model-based mocks and table-driven cases for request validation, required fields, channel permissions, attached-post loading, current-user loading, and repository validation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7238f

This PR adds table-driven coverage for the createIssue handler without changing production behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: avasconcelos114, jgheithcock

Poem

A rabbit checks each issue's trail

With tidy tests that never fail
Missing fields hop into view
Bad repositories join them too
The API garden blooms anew

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding tests for the createIssue handler.
Linked Issues check ✅ Passed The pull request adds table-driven API tests for createIssue, including validation and permission paths required by issue [#223].
Out of Scope Changes check ✅ Passed The changes are limited to the createIssue test coverage and its required model import. No unrelated changes are identified.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@rmdly

rmdly commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/check-cla

@nang2049 nang2049 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rmdly LGTM!

@nang2049
nang2049 merged commit 373a255 into mattermost:master Aug 31, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create tests for createIssue() method

3 participants