mocks

package
v0.26.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMockAll added in v0.26.0

func WithMockAll(options *loggerMockOptions)

WithMockAll is a LoggerMockOption that mocks calls to all log levels.

Types

type Logger

type Logger struct {
	mock.Mock
}

Logger is an autogenerated mock type for the Logger type

func NewLogger

func NewLogger(t interface {
	mock.TestingT
	Cleanup(func())
}) *Logger

NewLogger creates a new instance of Logger. 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 (*Logger) Debug

func (_m *Logger) Debug(format string, args ...interface{})

Debug provides a mock function with given fields: format, args

func (*Logger) EXPECT

func (_m *Logger) EXPECT() *Logger_Expecter

func (*Logger) Error

func (_m *Logger) Error(format string, args ...interface{})

Error provides a mock function with given fields: format, args

func (*Logger) Info

func (_m *Logger) Info(format string, args ...interface{})

Info provides a mock function with given fields: format, args

func (*Logger) Warn

func (_m *Logger) Warn(format string, args ...interface{})

Warn provides a mock function with given fields: format, args

func (*Logger) WithChannel

func (_m *Logger) WithChannel(channel string) log.Logger

WithChannel provides a mock function with given fields: channel

func (*Logger) WithContext

func (_m *Logger) WithContext(ctx context.Context) log.Logger

WithContext provides a mock function with given fields: ctx

func (*Logger) WithFields

func (_m *Logger) WithFields(_a0 log.Fields) log.Logger

WithFields provides a mock function with given fields: _a0

type LoggerMock added in v0.26.0

type LoggerMock interface {
	log.Logger
	Mock
	EXPECT() *Logger_Expecter
}

func NewLoggerMock

func NewLoggerMock(opts ...LoggerMockOption) LoggerMock

NewLoggerMock creates a new logger mock with the given options.

func NewLoggerMockedAll deprecated

func NewLoggerMockedAll(opts ...LoggerMockOption) LoggerMock

NewLoggerMockedAll is the same as NewLoggerMock(WithMockAll).

Deprecated: use NewLoggerMock(WithMockAll) instead.

func NewLoggerMockedUntilLevel deprecated

func NewLoggerMockedUntilLevel(level int, opts ...LoggerMockOption) LoggerMock

NewLoggerMockedUntilLevel returns a logger mocked up to the given log level. All other calls will cause an error and fail the test.

Deprecated: use NewLoggerMock(WithMockUntilLevel(level)) instead.

type LoggerMockOption added in v0.26.0

type LoggerMockOption func(*loggerMockOptions)

func WithMockUntilLevel added in v0.26.0

func WithMockUntilLevel(level int) LoggerMockOption

WithMockUntilLevel creates a LoggerMockOption that mocks calls up to the given log level. All other calls will cause an error and fail the test.

func WithTestingT added in v0.26.0

func WithTestingT(t *testing.T) LoggerMockOption

WithTestingT creates a LoggerMockOption that supplies the testing.T value to use for the logger. This enables the logger to fail the test instead of panicking (which could be caught) if a non-mocked log level is used, print the logs in case of a failed test after the test, and automatically assert any expectations for the created mock.

type Logger_Debug_Call

type Logger_Debug_Call struct {
	*mock.Call
}

Logger_Debug_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Debug'

func (*Logger_Debug_Call) Return

func (_c *Logger_Debug_Call) Return() *Logger_Debug_Call

func (*Logger_Debug_Call) Run

func (_c *Logger_Debug_Call) Run(run func(format string, args ...interface{})) *Logger_Debug_Call

func (*Logger_Debug_Call) RunAndReturn

func (_c *Logger_Debug_Call) RunAndReturn(run func(string, ...interface{})) *Logger_Debug_Call

type Logger_Error_Call

type Logger_Error_Call struct {
	*mock.Call
}

Logger_Error_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Error'

func (*Logger_Error_Call) Return

func (_c *Logger_Error_Call) Return() *Logger_Error_Call

func (*Logger_Error_Call) Run

func (_c *Logger_Error_Call) Run(run func(format string, args ...interface{})) *Logger_Error_Call

func (*Logger_Error_Call) RunAndReturn

func (_c *Logger_Error_Call) RunAndReturn(run func(string, ...interface{})) *Logger_Error_Call

type Logger_Expecter

type Logger_Expecter struct {
	// contains filtered or unexported fields
}

func (*Logger_Expecter) Debug

func (_e *Logger_Expecter) Debug(format interface{}, args ...interface{}) *Logger_Debug_Call

Debug is a helper method to define mock.On call

  • format string
  • args ...interface{}

func (*Logger_Expecter) Error

func (_e *Logger_Expecter) Error(format interface{}, args ...interface{}) *Logger_Error_Call

Error is a helper method to define mock.On call

  • format string
  • args ...interface{}

func (*Logger_Expecter) Info

func (_e *Logger_Expecter) Info(format interface{}, args ...interface{}) *Logger_Info_Call

Info is a helper method to define mock.On call

  • format string
  • args ...interface{}

func (*Logger_Expecter) Warn

func (_e *Logger_Expecter) Warn(format interface{}, args ...interface{}) *Logger_Warn_Call

Warn is a helper method to define mock.On call

  • format string
  • args ...interface{}

func (*Logger_Expecter) WithChannel

func (_e *Logger_Expecter) WithChannel(channel interface{}) *Logger_WithChannel_Call

WithChannel is a helper method to define mock.On call

  • channel string

func (*Logger_Expecter) WithContext

func (_e *Logger_Expecter) WithContext(ctx interface{}) *Logger_WithContext_Call

WithContext is a helper method to define mock.On call

  • ctx context.Context

func (*Logger_Expecter) WithFields

func (_e *Logger_Expecter) WithFields(_a0 interface{}) *Logger_WithFields_Call

WithFields is a helper method to define mock.On call

  • _a0 log.Fields

type Logger_Info_Call

type Logger_Info_Call struct {
	*mock.Call
}

Logger_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'

func (*Logger_Info_Call) Return

func (_c *Logger_Info_Call) Return() *Logger_Info_Call

func (*Logger_Info_Call) Run

func (_c *Logger_Info_Call) Run(run func(format string, args ...interface{})) *Logger_Info_Call

func (*Logger_Info_Call) RunAndReturn

func (_c *Logger_Info_Call) RunAndReturn(run func(string, ...interface{})) *Logger_Info_Call

type Logger_Warn_Call

type Logger_Warn_Call struct {
	*mock.Call
}

Logger_Warn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Warn'

func (*Logger_Warn_Call) Return

func (_c *Logger_Warn_Call) Return() *Logger_Warn_Call

func (*Logger_Warn_Call) Run

func (_c *Logger_Warn_Call) Run(run func(format string, args ...interface{})) *Logger_Warn_Call

func (*Logger_Warn_Call) RunAndReturn

func (_c *Logger_Warn_Call) RunAndReturn(run func(string, ...interface{})) *Logger_Warn_Call

type Logger_WithChannel_Call

type Logger_WithChannel_Call struct {
	*mock.Call
}

Logger_WithChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithChannel'

func (*Logger_WithChannel_Call) Return

func (*Logger_WithChannel_Call) Run

func (_c *Logger_WithChannel_Call) Run(run func(channel string)) *Logger_WithChannel_Call

func (*Logger_WithChannel_Call) RunAndReturn

func (_c *Logger_WithChannel_Call) RunAndReturn(run func(string) log.Logger) *Logger_WithChannel_Call

type Logger_WithContext_Call

type Logger_WithContext_Call struct {
	*mock.Call
}

Logger_WithContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithContext'

func (*Logger_WithContext_Call) Return

func (*Logger_WithContext_Call) Run

func (*Logger_WithContext_Call) RunAndReturn

type Logger_WithFields_Call

type Logger_WithFields_Call struct {
	*mock.Call
}

Logger_WithFields_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithFields'

func (*Logger_WithFields_Call) Return

func (*Logger_WithFields_Call) Run

func (_c *Logger_WithFields_Call) Run(run func(_a0 log.Fields)) *Logger_WithFields_Call

func (*Logger_WithFields_Call) RunAndReturn

func (_c *Logger_WithFields_Call) RunAndReturn(run func(log.Fields) log.Logger) *Logger_WithFields_Call

type Mock added in v0.26.0

type Mock interface {
	String() string
	TestData() objx.Map
	Test(t mock.TestingT)
	On(methodName string, arguments ...interface{}) *mock.Call
	Called(arguments ...interface{}) mock.Arguments
	MethodCalled(methodName string, arguments ...interface{}) mock.Arguments
	AssertExpectations(t mock.TestingT) bool
	AssertNumberOfCalls(t mock.TestingT, methodName string, expectedCalls int) bool
	AssertCalled(t mock.TestingT, methodName string, arguments ...interface{}) bool
	AssertNotCalled(t mock.TestingT, methodName string, arguments ...interface{}) bool
	IsMethodCallable(t mock.TestingT, methodName string, arguments ...interface{}) bool
}

type SentryHub

type SentryHub struct {
	mock.Mock
}

SentryHub is an autogenerated mock type for the SentryHub type

func NewSentryHub

func NewSentryHub(t interface {
	mock.TestingT
	Cleanup(func())
}) *SentryHub

NewSentryHub creates a new instance of SentryHub. 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 (*SentryHub) CaptureException

func (_m *SentryHub) CaptureException(exception error) *sentry.EventID

CaptureException provides a mock function with given fields: exception

func (*SentryHub) ConfigureScope

func (_m *SentryHub) ConfigureScope(f func(*sentry.Scope))

ConfigureScope provides a mock function with given fields: f

func (*SentryHub) EXPECT

func (_m *SentryHub) EXPECT() *SentryHub_Expecter

func (*SentryHub) Flush

func (_m *SentryHub) Flush(timeout time.Duration) bool

Flush provides a mock function with given fields: timeout

func (*SentryHub) WithScope

func (_m *SentryHub) WithScope(f func(*sentry.Scope))

WithScope provides a mock function with given fields: f

type SentryHub_CaptureException_Call

type SentryHub_CaptureException_Call struct {
	*mock.Call
}

SentryHub_CaptureException_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CaptureException'

func (*SentryHub_CaptureException_Call) Return

func (*SentryHub_CaptureException_Call) Run

func (*SentryHub_CaptureException_Call) RunAndReturn

type SentryHub_ConfigureScope_Call

type SentryHub_ConfigureScope_Call struct {
	*mock.Call
}

SentryHub_ConfigureScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureScope'

func (*SentryHub_ConfigureScope_Call) Return

func (*SentryHub_ConfigureScope_Call) Run

func (*SentryHub_ConfigureScope_Call) RunAndReturn

func (_c *SentryHub_ConfigureScope_Call) RunAndReturn(run func(func(*sentry.Scope))) *SentryHub_ConfigureScope_Call

type SentryHub_Expecter

type SentryHub_Expecter struct {
	// contains filtered or unexported fields
}

func (*SentryHub_Expecter) CaptureException

func (_e *SentryHub_Expecter) CaptureException(exception interface{}) *SentryHub_CaptureException_Call

CaptureException is a helper method to define mock.On call

  • exception error

func (*SentryHub_Expecter) ConfigureScope

func (_e *SentryHub_Expecter) ConfigureScope(f interface{}) *SentryHub_ConfigureScope_Call

ConfigureScope is a helper method to define mock.On call

  • f func(*sentry.Scope)

func (*SentryHub_Expecter) Flush

func (_e *SentryHub_Expecter) Flush(timeout interface{}) *SentryHub_Flush_Call

Flush is a helper method to define mock.On call

  • timeout time.Duration

func (*SentryHub_Expecter) WithScope

func (_e *SentryHub_Expecter) WithScope(f interface{}) *SentryHub_WithScope_Call

WithScope is a helper method to define mock.On call

  • f func(*sentry.Scope)

type SentryHub_Flush_Call

type SentryHub_Flush_Call struct {
	*mock.Call
}

SentryHub_Flush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flush'

func (*SentryHub_Flush_Call) Return

func (*SentryHub_Flush_Call) Run

func (_c *SentryHub_Flush_Call) Run(run func(timeout time.Duration)) *SentryHub_Flush_Call

func (*SentryHub_Flush_Call) RunAndReturn

func (_c *SentryHub_Flush_Call) RunAndReturn(run func(time.Duration) bool) *SentryHub_Flush_Call

type SentryHub_WithScope_Call

type SentryHub_WithScope_Call struct {
	*mock.Call
}

SentryHub_WithScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithScope'

func (*SentryHub_WithScope_Call) Return

func (*SentryHub_WithScope_Call) Run

func (_c *SentryHub_WithScope_Call) Run(run func(f func(*sentry.Scope))) *SentryHub_WithScope_Call

func (*SentryHub_WithScope_Call) RunAndReturn

func (_c *SentryHub_WithScope_Call) RunAndReturn(run func(func(*sentry.Scope))) *SentryHub_WithScope_Call

Jump to

Keyboard shortcuts

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