mocks

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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

func AssertQueuedMessage(t *testing.T, expected msg.Message)

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

func AssertSlackJSON(t *testing.T, slackClient *SlackClient, message msg.Ref, expected string)

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

func LockInternalMessages() *sync.Mutex

LockInternalMessages uses mutex to block other tests dealing with the central message queue

func NewPseudoRandom added in v2.3.4

func NewPseudoRandom() *rand.Rand

NewPseudoRandom returns a deterministic random source for testing purposes. In production, random seed is used

func WaitForQueuedMessages added in v2.2.6

func WaitForQueuedMessages(t *testing.T, count int) func() []msg.Message

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

func WaitTillHavingInternalMessage() msg.Message

WaitTillHavingInternalMessage blocks until there is a internal message queued. If there is no message after 2s -> exit!

Types

type Client

type Client struct {
	mock.Mock
}

Client is an autogenerated mock type for the Client type

func NewClient added in v2.3.1

func NewClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *Client

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.3.4

func (_m *Client) GetAllJobNames(ctx context.Context) ([]gojenkins.InnerJob, error)

GetAllJobNames provides a mock function with given fields: ctx

func (*Client) GetAllNodes

func (_m *Client) GetAllNodes(ctx context.Context) ([]*gojenkins.Node, error)

GetAllNodes provides a mock function with given fields: ctx

func (*Client) GetFolder added in v2.3.4

func (_m *Client) GetFolder(ctx context.Context, id string, parents ...string) (*gojenkins.Folder, error)

GetFolder provides a mock function with given fields: ctx, id, parents

func (*Client) GetJob

func (_m *Client) GetJob(ctx context.Context, id string) (*gojenkins.Job, error)

GetJob provides a mock function with given fields: ctx, id

type SlackClient

type SlackClient struct {
	mock.Mock
}

SlackClient is an autogenerated mock type for the SlackClient type

func NewSlackClient added in v2.3.1

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

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.3.1

func (_m *SlackClient) GetThreadMessages(ref msg.Ref) ([]slack.Message, error)

GetThreadMessages provides a mock function with given fields: ref

func (*SlackClient) GetUserPresence added in v2.3.3

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.3.0

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

func (_m *SlackClient) SendEphemeralMessage(ref msg.Ref, text string, options ...slack.MsgOption)

SendEphemeralMessage provides a mock function with given fields: ref, text, options

func (*SlackClient) SendMessage

func (_m *SlackClient) SendMessage(ref msg.Ref, text string, options ...slack.MsgOption) string

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.3.4

func (_m *SlackClient) UploadFile(params slack.FileUploadParameters) (*slack.File, error)

UploadFile provides a mock function with given fields: params

Jump to

Keyboard shortcuts

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