mocks

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 3 Imported by: 0

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 {
	// 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)
	// 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{
		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")
		},
	}

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

}

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) 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