Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
*jira.Client
}
APIClient represents an interface to Jira API. It embeds `go-jira`'s `jira.APIClient`.
func NewAPIClient ¶
func NewAPIClient() *APIClient
NewAPIClient returns an usable `jira.client` usable to access Jira API. It embeds a `jira.APIClient`.
func (*APIClient) ExploreCustomFields ¶
ExploreCustomFields prints information about custom fields by fetching the specified issue. This can be used to retrieve the custom fields IDs by fetching an issue with identifiable values for these fields.
func (*APIClient) ExploreRawIssue ¶
ExploreRawIssue prints the raw data fetched from Jira. This can be used to get the structure of an issue to implement new features.
func (*APIClient) GetIssue ¶
GetIssue fetches the issue specified by the key from the Jira API using `go-jira` and returns a `jira.Issue`.
func (*APIClient) SearchIssues ¶
SearchIssues perform a search on Jira API using the specified JQL `query` and sends the keys of the issues in the response through the `issueKeys` channel.
type Expectation ¶
type Expectation interface {
Describe() string
}
Expectation is a specific interface for structs representing expectations for the mock. They implement a `Describe` method that can be used by the mock to display when there is a mismatch between the expected call and the call it received.
type ExpectedGetIssue ¶
type ExpectedGetIssue struct {
// contains filtered or unexported fields
}
ExpectedGetIssue represents an expectation to receive a `GetIssue` call
func (*ExpectedGetIssue) Describe ¶
func (e *ExpectedGetIssue) Describe() string
Describe describes the `GetIssue` expectation
func (*ExpectedGetIssue) WillRespondWithIssue ¶
func (e *ExpectedGetIssue) WillRespondWithIssue(issue *jira.Issue)
WillRespondWithIssue specified that the `ExpectedGetIssue` expectation should respond with the passed issue.
type ExpectedSearchIssues ¶
type ExpectedSearchIssues struct {
// contains filtered or unexported fields
}
ExpectedSearchIssues is an expectation for `SearchIssues`
func (*ExpectedSearchIssues) Describe ¶
func (e *ExpectedSearchIssues) Describe() string
Describe describes the `SearchIssues` expectation
func (*ExpectedSearchIssues) WillRespondWithIssueKeys ¶
func (e *ExpectedSearchIssues) WillRespondWithIssueKeys(issueKeys []string)
WillRespondWithIssueKeys indicates `ExpectedSearchIssues` expectation should send the specified issue keys when called.
type MockClient ¶
MockClient is a mock to fake a client to Jira API. It implements the `jira.Client` interface.
func NewMockClient ¶
func NewMockClient(t *testing.T) *MockClient
NewMockClient returns a new `MockClient` with a default behaviour.
func (*MockClient) ExpectGetIssue ¶
func (c *MockClient) ExpectGetIssue(issueKey string) *ExpectedGetIssue
ExpectGetIssue indicates the mock is expected to receive a `GetIssue` call with the specified issue key
func (*MockClient) ExpectSearchIssues ¶
func (c *MockClient) ExpectSearchIssues(query string) *ExpectedSearchIssues
ExpectSearchIssues indicates the mock should expect a call to `SearchIssues` with the specified query.
NB: the query is matched exactly.
func (*MockClient) GetIssue ¶
func (c *MockClient) GetIssue(issueKey string) *jira.Issue
GetIssue fakes fetching the issue specified by its key. To have it return a `jira.Issue`, use `WillRespondWithIssue(..)`.
func (*MockClient) SearchIssues ¶
func (c *MockClient) SearchIssues(query string, issueKeys chan string)
SearchIssues fakes a search issues query to the Jira API. The `query` parameter is ignored. The list of issue keys passed when initializing the mock is sent through the `issueKeys` channel. When all keys have been sent, the channel is closed.