Documentation
¶
Overview ¶
Package jiramock provides a stateful mock Jira REST API server for behaviour tests. The mock implements the endpoints that jira.LiveClient calls, backed by in-memory state that step definitions manipulate between requests.
Index ¶
- type State
- func (s *State) AddComment(issueKey, body string)
- func (s *State) AddCommentFromActor(issueKey, body, accountID, displayName string)
- func (s *State) AddIssue(key string, labels []string)
- func (s *State) AddLabelChange(issueKey, label string)
- func (s *State) SetRoleGroup(roleName, groupID string)
- func (s *State) SetUserGroups(accountID string, groupIDs ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds the mutable mock data. All methods are safe for concurrent use.
func NewServer ¶
NewServer creates a mock Jira REST API server and returns the httptest server and its backing state. The caller should defer srv.Close().
func (*State) AddComment ¶
AddComment appends a comment to the given issue. The comment is authored by a canned human user (not a bot).
func (*State) AddCommentFromActor ¶ added in v0.36.0
AddCommentFromActor appends a comment to the given issue, authored by the given account. Used to test role resolution for actors other than the default canned commenter.
func (*State) AddIssue ¶
AddIssue inserts an issue with the given key and labels. A synthetic numeric ID and timestamp are assigned automatically.
func (*State) AddLabelChange ¶
AddLabelChange appends a changelog entry representing a label addition and updates the issue's label list.
func (*State) SetRoleGroup ¶ added in v0.36.0
SetRoleGroup registers a project role as backed by the given group ID, in addition to the canned "Developers" role (whose direct users are commenter-001 and changer-001). Backs GET /project/{key}/role[/{id}] with a group-actor role, for testing per-actor group-based role resolution (GetProjectRoleActors + GetUserGroups) end-to-end.
func (*State) SetUserGroups ¶ added in v0.36.0
SetUserGroups registers the groups a Jira user belongs to, backing GET /user/groups for per-actor role resolution.