jiramock

package
v0.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

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

func NewServer() (*httptest.Server, *State)

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

func (s *State) AddComment(issueKey, body string)

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

func (s *State) AddCommentFromActor(issueKey, body, accountID, displayName string)

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

func (s *State) AddIssue(key string, labels []string)

AddIssue inserts an issue with the given key and labels. A synthetic numeric ID and timestamp are assigned automatically.

func (*State) AddLabelChange

func (s *State) AddLabelChange(issueKey, label string)

AddLabelChange appends a changelog entry representing a label addition and updates the issue's label list.

func (*State) SetRoleGroup added in v0.36.0

func (s *State) SetRoleGroup(roleName, groupID string)

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

func (s *State) SetUserGroups(accountID string, groupIDs ...string)

SetUserGroups registers the groups a Jira user belongs to, backing GET /user/groups for per-actor role resolution.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL