mocks

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 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, summary string, err error, fields []slack.Field) (*slack.MessageRef, error)

	// SendInfoFunc mocks the SendInfo method.
	SendInfoFunc func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error)

	// SendPublishLogFunc mocks the SendPublishLog method.
	SendPublishLogFunc func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error)

	// SendWarningFunc mocks the SendWarning method.
	SendWarningFunc func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error)

	// UpdatePublishLogFunc mocks the UpdatePublishLog method.
	UpdatePublishLogFunc func(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*slack.MessageRef, error)

	// UpdatePublishLogAsAlarmFunc mocks the UpdatePublishLogAsAlarm method.
	UpdatePublishLogAsAlarmFunc func(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*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, summary string, err error, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the SendAlarm method")
		},
		SendInfoFunc: func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the SendInfo method")
		},
		SendPublishLogFunc: func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the SendPublishLog method")
		},
		SendWarningFunc: func(ctx context.Context, summary string, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the SendWarning method")
		},
		UpdatePublishLogFunc: func(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the UpdatePublishLog method")
		},
		UpdatePublishLogAsAlarmFunc: func(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*slack.MessageRef, error) {
			panic("mock out the UpdatePublishLogAsAlarm 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, summary string, err error, fields []slack.Field) (*slack.MessageRef, error)

SendAlarm calls SendAlarmFunc.

func (*ClienterMock) SendAlarmCalls added in v1.12.0

func (mock *ClienterMock) SendAlarmCalls() []struct {
	Ctx     context.Context
	Summary string
	Err     error
	Fields  []slack.Field
}

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, summary string, fields []slack.Field) (*slack.MessageRef, error)

SendInfo calls SendInfoFunc.

func (*ClienterMock) SendInfoCalls added in v1.12.0

func (mock *ClienterMock) SendInfoCalls() []struct {
	Ctx     context.Context
	Summary string
	Fields  []slack.Field
}

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, summary string, fields []slack.Field) (*slack.MessageRef, error)

SendPublishLog calls SendPublishLogFunc.

func (*ClienterMock) SendPublishLogCalls added in v1.20.0

func (mock *ClienterMock) SendPublishLogCalls() []struct {
	Ctx     context.Context
	Summary string
	Fields  []slack.Field
}

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, summary string, fields []slack.Field) (*slack.MessageRef, error)

SendWarning calls SendWarningFunc.

func (*ClienterMock) SendWarningCalls added in v1.12.0

func (mock *ClienterMock) SendWarningCalls() []struct {
	Ctx     context.Context
	Summary string
	Fields  []slack.Field
}

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

len(mockedClienter.SendWarningCalls())

func (*ClienterMock) UpdatePublishLog added in v1.20.0

func (mock *ClienterMock) UpdatePublishLog(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*slack.MessageRef, error)

UpdatePublishLog calls UpdatePublishLogFunc.

func (*ClienterMock) UpdatePublishLogAsAlarm added in v1.21.0

func (mock *ClienterMock) UpdatePublishLogAsAlarm(ctx context.Context, ref *slack.MessageRef, summary string, fields []slack.Field) (*slack.MessageRef, error)

UpdatePublishLogAsAlarm calls UpdatePublishLogAsAlarmFunc.

func (*ClienterMock) UpdatePublishLogAsAlarmCalls added in v1.21.0

func (mock *ClienterMock) UpdatePublishLogAsAlarmCalls() []struct {
	Ctx     context.Context
	Ref     *slack.MessageRef
	Summary string
	Fields  []slack.Field
}

UpdatePublishLogAsAlarmCalls gets all the calls that were made to UpdatePublishLogAsAlarm. Check the length with:

len(mockedClienter.UpdatePublishLogAsAlarmCalls())

func (*ClienterMock) UpdatePublishLogCalls added in v1.20.0

func (mock *ClienterMock) UpdatePublishLogCalls() []struct {
	Ctx     context.Context
	Ref     *slack.MessageRef
	Summary string
	Fields  []slack.Field
}

UpdatePublishLogCalls gets all the calls that were made to UpdatePublishLog. Check the length with:

len(mockedClienter.UpdatePublishLogCalls())

Jump to

Keyboard shortcuts

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