mocks

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClienterMock added in v1.12.0

type ClienterMock struct {
	// GetTimeoutFunc mocks the GetTimeout method.
	GetTimeoutFunc func() time.Duration

	// SendAlarmFunc mocks the SendAlarm method.
	SendAlarmFunc func(ctx context.Context, title string, err error, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

	// SendInfoFunc mocks the SendInfo method.
	SendInfoFunc func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

	// SendPublishLogFunc mocks the SendPublishLog method.
	SendPublishLogFunc func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

	// SendWarningFunc mocks the SendWarning method.
	SendWarningFunc func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

	// UpdateMessageFunc mocks the UpdateMessage method.
	UpdateMessageFunc func(ctx context.Context, ref *slack.MessageRef, title string, err error, details []slack.Detail, links []slack.Link, color slack.Colour, emoji slack.Emoji) (*slack.MessageRef, error)
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of slack.Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked slack.Clienter
	mockedClienter := &ClienterMock{
		GetTimeoutFunc: func() time.Duration {
			panic("mock out the GetTimeout method")
		},
		SendAlarmFunc: func(ctx context.Context, title string, err error, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error) {
			panic("mock out the SendAlarm method")
		},
		SendInfoFunc: func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error) {
			panic("mock out the SendInfo method")
		},
		SendPublishLogFunc: func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error) {
			panic("mock out the SendPublishLog method")
		},
		SendWarningFunc: func(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error) {
			panic("mock out the SendWarning method")
		},
		UpdateMessageFunc: func(ctx context.Context, ref *slack.MessageRef, title string, err error, details []slack.Detail, links []slack.Link, color slack.Colour, emoji slack.Emoji) (*slack.MessageRef, error) {
			panic("mock out the UpdateMessage method")
		},
	}

	// use mockedClienter in code that requires slack.Clienter
	// and then make assertions.

}

func (*ClienterMock) GetTimeout added in v1.26.0

func (mock *ClienterMock) GetTimeout() time.Duration

GetTimeout calls GetTimeoutFunc.

func (*ClienterMock) GetTimeoutCalls added in v1.26.0

func (mock *ClienterMock) GetTimeoutCalls() []struct {
}

GetTimeoutCalls gets all the calls that were made to GetTimeout. Check the length with:

len(mockedClienter.GetTimeoutCalls())

func (*ClienterMock) SendAlarm added in v1.12.0

func (mock *ClienterMock) SendAlarm(ctx context.Context, title string, err error, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

SendAlarm calls SendAlarmFunc.

func (*ClienterMock) SendAlarmCalls added in v1.12.0

func (mock *ClienterMock) SendAlarmCalls() []struct {
	Ctx     context.Context
	Title   string
	Err     error
	Details []slack.Detail
	Links   []slack.Link
}

SendAlarmCalls gets all the calls that were made to SendAlarm. Check the length with:

len(mockedClienter.SendAlarmCalls())

func (*ClienterMock) SendInfo added in v1.12.0

func (mock *ClienterMock) SendInfo(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

SendInfo calls SendInfoFunc.

func (*ClienterMock) SendInfoCalls added in v1.12.0

func (mock *ClienterMock) SendInfoCalls() []struct {
	Ctx     context.Context
	Title   string
	Details []slack.Detail
	Links   []slack.Link
}

SendInfoCalls gets all the calls that were made to SendInfo. Check the length with:

len(mockedClienter.SendInfoCalls())

func (*ClienterMock) SendPublishLog added in v1.20.0

func (mock *ClienterMock) SendPublishLog(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

SendPublishLog calls SendPublishLogFunc.

func (*ClienterMock) SendPublishLogCalls added in v1.20.0

func (mock *ClienterMock) SendPublishLogCalls() []struct {
	Ctx     context.Context
	Title   string
	Details []slack.Detail
	Links   []slack.Link
}

SendPublishLogCalls gets all the calls that were made to SendPublishLog. Check the length with:

len(mockedClienter.SendPublishLogCalls())

func (*ClienterMock) SendWarning added in v1.12.0

func (mock *ClienterMock) SendWarning(ctx context.Context, title string, details []slack.Detail, links []slack.Link) (*slack.MessageRef, error)

SendWarning calls SendWarningFunc.

func (*ClienterMock) SendWarningCalls added in v1.12.0

func (mock *ClienterMock) SendWarningCalls() []struct {
	Ctx     context.Context
	Title   string
	Details []slack.Detail
	Links   []slack.Link
}

SendWarningCalls gets all the calls that were made to SendWarning. Check the length with:

len(mockedClienter.SendWarningCalls())

func (*ClienterMock) UpdateMessage added in v1.27.0

func (mock *ClienterMock) UpdateMessage(ctx context.Context, ref *slack.MessageRef, title string, err error, details []slack.Detail, links []slack.Link, color slack.Colour, emoji slack.Emoji) (*slack.MessageRef, error)

UpdateMessage calls UpdateMessageFunc.

func (*ClienterMock) UpdateMessageCalls added in v1.27.0

func (mock *ClienterMock) UpdateMessageCalls() []struct {
	Ctx     context.Context
	Ref     *slack.MessageRef
	Title   string
	Err     error
	Details []slack.Detail
	Links   []slack.Link
	Color   slack.Colour
	Emoji   slack.Emoji
}

UpdateMessageCalls gets all the calls that were made to UpdateMessage. Check the length with:

len(mockedClienter.UpdateMessageCalls())

Jump to

Keyboard shortcuts

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