Documentation ¶
Index ¶
- func AssertContainsSlackBlocks(t *testing.T, slackClient *SlackClient, message msg.Ref, block slack.Block)
- func AssertError(slackClient *SlackClient, ref msg.Ref, errorIn any)
- func AssertQueuedMessage(t *testing.T, expected msg.Message)
- func AssertReaction(slackClient *SlackClient, reaction string, ref msg.Ref)
- func AssertRemoveReaction(slackClient *SlackClient, reaction string, ref msg.Ref)
- func AssertSlackBlocks(t *testing.T, slackClient *SlackClient, message msg.Ref, expectedJSON string)
- func AssertSlackJSON(t *testing.T, slackClient *SlackClient, message msg.Ref, expected string)
- func AssertSlackMessage(slackClient *SlackClient, ref msg.Ref, text string, option ...any)
- func AssertSlackMessageRegexp(slackClient *SlackClient, ref msg.Ref, pattern string)
- func LockInternalMessages() *sync.Mutex
- func NewPseudoRandom() *rand.Rand
- func WaitForQueuedMessages(t *testing.T, count int) func() []msg.Message
- func WaitTillHavingInternalMessage() msg.Message
- type Client
- func (_m *Client) BuildJob(ctx context.Context, name string, params map[string]string) (int64, error)
- func (_m *Client) GetAllJobNames(ctx context.Context) ([]gojenkins.InnerJob, error)
- func (_m *Client) GetAllNodes(ctx context.Context) ([]*gojenkins.Node, error)
- func (_m *Client) GetFolder(ctx context.Context, id string, parents ...string) (*gojenkins.Folder, error)
- func (_m *Client) GetJob(ctx context.Context, id string) (*gojenkins.Job, error)
- type SlackClient
- func (_m *SlackClient) AddReaction(reaction util.Reaction, ref msg.Ref)
- func (_m *SlackClient) GetConversationHistory(_a0 *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
- func (_m *SlackClient) GetReactions(item slack.ItemRef, params slack.GetReactionsParameters) ([]slack.ItemReaction, error)
- func (_m *SlackClient) GetThreadMessages(ref msg.Ref) ([]slack.Message, error)
- func (_m *SlackClient) GetUserPresence(user string) (*slack.UserPresence, error)
- func (_m *SlackClient) RemoveReaction(reaction util.Reaction, ref msg.Ref)
- func (_m *SlackClient) ReplyError(ref msg.Ref, err error)
- func (_m *SlackClient) SendBlockMessage(ref msg.Ref, blocks []slack.Block, options ...slack.MsgOption) string
- func (_m *SlackClient) SendBlockMessageToUser(user string, blocks []slack.Block, options ...slack.MsgOption) string
- func (_m *SlackClient) SendEphemeralMessage(ref msg.Ref, text string, options ...slack.MsgOption)
- func (_m *SlackClient) SendMessage(ref msg.Ref, text string, options ...slack.MsgOption) string
- func (_m *SlackClient) SendToUser(user string, text string)
- func (_m *SlackClient) UploadFile(params slack.FileUploadParameters) (*slack.File, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContainsSlackBlocks ¶
func AssertContainsSlackBlocks(t *testing.T, slackClient *SlackClient, message msg.Ref, block slack.Block)
AssertContainsSlackBlocks is a small test helper to check for certain slack.Block
func AssertError ¶
func AssertError(slackClient *SlackClient, ref msg.Ref, errorIn any)
AssertError is a test helper which check for calls to "ReplyError"
func AssertQueuedMessage ¶
AssertQueuedMessage checks if a given internal message was queued
func AssertReaction ¶
func AssertReaction(slackClient *SlackClient, reaction string, ref msg.Ref)
AssertReaction is a test helper to expect a given slack reaction to be added
func AssertRemoveReaction ¶
func AssertRemoveReaction(slackClient *SlackClient, reaction string, ref msg.Ref)
AssertRemoveReaction is a test helper to expect a given slack reaction to be removed
func AssertSlackBlocks ¶
func AssertSlackBlocks(t *testing.T, slackClient *SlackClient, message msg.Ref, expectedJSON string)
AssertSlackBlocks test helper to assert a given JSON representation of "Blocks"
func AssertSlackJSON ¶
AssertSlackJSON is a test helper to assert full slack attachments
func AssertSlackMessage ¶
func AssertSlackMessage(slackClient *SlackClient, ref msg.Ref, text string, option ...any)
AssertSlackMessage is a test helper to check for a given slack message
func AssertSlackMessageRegexp ¶ added in v2.2.4
func AssertSlackMessageRegexp(slackClient *SlackClient, ref msg.Ref, pattern string)
AssertSlackMessageRegexp is a test helper to check for a given slack message based on a regular expression
func LockInternalMessages ¶
LockInternalMessages uses mutex to block other tests dealing with the central message queue
func NewPseudoRandom ¶ added in v2.2.10
NewPseudoRandom returns a deterministic random source for testing purposes. In production, random seed is used
func WaitForQueuedMessages ¶ added in v2.2.6
WaitForQueuedMessages waits until all "count" messages are queued and returns them in the returned function. We get a failed test when there are more messages than expected or not enough messages after 1 second of timeout.
func WaitTillHavingInternalMessage ¶
WaitTillHavingInternalMessage blocks until there is a internal message queued. If there is no message after 2s -> exit!
Types ¶
type Client ¶
Client is an autogenerated mock type for the Client type
func NewClient ¶ added in v2.2.10
NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Client) BuildJob ¶
func (_m *Client) BuildJob(ctx context.Context, name string, params map[string]string) (int64, error)
BuildJob provides a mock function with given fields: ctx, name, params
func (*Client) GetAllJobNames ¶ added in v2.2.10
GetAllJobNames provides a mock function with given fields: ctx
func (*Client) GetAllNodes ¶
GetAllNodes provides a mock function with given fields: ctx
type SlackClient ¶
SlackClient is an autogenerated mock type for the SlackClient type
func NewSlackClient ¶ added in v2.2.10
func NewSlackClient(t interface { mock.TestingT Cleanup(func()) }) *SlackClient
NewSlackClient creates a new instance of SlackClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*SlackClient) AddReaction ¶
func (_m *SlackClient) AddReaction(reaction util.Reaction, ref msg.Ref)
AddReaction provides a mock function with given fields: reaction, ref
func (*SlackClient) GetConversationHistory ¶
func (_m *SlackClient) GetConversationHistory(_a0 *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
GetConversationHistory provides a mock function with given fields: _a0
func (*SlackClient) GetReactions ¶
func (_m *SlackClient) GetReactions(item slack.ItemRef, params slack.GetReactionsParameters) ([]slack.ItemReaction, error)
GetReactions provides a mock function with given fields: item, params
func (*SlackClient) GetThreadMessages ¶ added in v2.2.10
GetThreadMessages provides a mock function with given fields: ref
func (*SlackClient) GetUserPresence ¶ added in v2.2.10
func (_m *SlackClient) GetUserPresence(user string) (*slack.UserPresence, error)
GetUserPresence provides a mock function with given fields: user
func (*SlackClient) RemoveReaction ¶
func (_m *SlackClient) RemoveReaction(reaction util.Reaction, ref msg.Ref)
RemoveReaction provides a mock function with given fields: reaction, ref
func (*SlackClient) ReplyError ¶
func (_m *SlackClient) ReplyError(ref msg.Ref, err error)
ReplyError provides a mock function with given fields: ref, err
func (*SlackClient) SendBlockMessage ¶
func (_m *SlackClient) SendBlockMessage(ref msg.Ref, blocks []slack.Block, options ...slack.MsgOption) string
SendBlockMessage provides a mock function with given fields: ref, blocks, options
func (*SlackClient) SendBlockMessageToUser ¶ added in v2.2.10
func (_m *SlackClient) SendBlockMessageToUser(user string, blocks []slack.Block, options ...slack.MsgOption) string
SendBlockMessageToUser provides a mock function with given fields: user, blocks, options
func (*SlackClient) SendEphemeralMessage ¶ added in v2.2.4
SendEphemeralMessage provides a mock function with given fields: ref, text, options
func (*SlackClient) SendMessage ¶
SendMessage provides a mock function with given fields: ref, text, options
func (*SlackClient) SendToUser ¶
func (_m *SlackClient) SendToUser(user string, text string)
SendToUser provides a mock function with given fields: user, text
func (*SlackClient) UploadFile ¶ added in v2.2.10
func (_m *SlackClient) UploadFile(params slack.FileUploadParameters) (*slack.File, error)
UploadFile provides a mock function with given fields: params