utils_mock

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ILogHandlerMock

type ILogHandlerMock struct {
	// DeleteLogsFunc mocks the DeleteLogs method.
	DeleteLogsFunc func(filter models.LogFilter) error

	// FlushFunc mocks the Flush method.
	FlushFunc func() error

	// GetLogsFunc mocks the GetLogs method.
	GetLogsFunc func(params models.GetLogsParams) (*models.GetLogsResponse, error)

	// LogFunc mocks the Log method.
	LogFunc func(logs []models.LogEntry)

	// StartFunc mocks the Start method.
	StartFunc func(ctx context.Context)
	// contains filtered or unexported fields
}

ILogHandlerMock is a mock implementation of api.ILogHandler.

func TestSomethingThatUsesILogHandler(t *testing.T) {

	// make and configure a mocked api.ILogHandler
	mockedILogHandler := &ILogHandlerMock{
		DeleteLogsFunc: func(filter models.LogFilter) error {
			panic("mock out the DeleteLogs method")
		},
		FlushFunc: func() error {
			panic("mock out the Flush method")
		},
		GetLogsFunc: func(params models.GetLogsParams) (*models.GetLogsResponse, error) {
			panic("mock out the GetLogs method")
		},
		LogFunc: func(logs []models.LogEntry)  {
			panic("mock out the Log method")
		},
		StartFunc: func(ctx context.Context)  {
			panic("mock out the Start method")
		},
	}

	// use mockedILogHandler in code that requires api.ILogHandler
	// and then make assertions.

}

func (*ILogHandlerMock) DeleteLogs

func (mock *ILogHandlerMock) DeleteLogs(filter models.LogFilter) error

DeleteLogs calls DeleteLogsFunc.

func (*ILogHandlerMock) DeleteLogsCalls

func (mock *ILogHandlerMock) DeleteLogsCalls() []struct {
	Filter models.LogFilter
}

DeleteLogsCalls gets all the calls that were made to DeleteLogs. Check the length with:

len(mockedILogHandler.DeleteLogsCalls())

func (*ILogHandlerMock) Flush

func (mock *ILogHandlerMock) Flush() error

Flush calls FlushFunc.

func (*ILogHandlerMock) FlushCalls

func (mock *ILogHandlerMock) FlushCalls() []struct {
}

FlushCalls gets all the calls that were made to Flush. Check the length with:

len(mockedILogHandler.FlushCalls())

func (*ILogHandlerMock) GetLogs

func (mock *ILogHandlerMock) GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)

GetLogs calls GetLogsFunc.

func (*ILogHandlerMock) GetLogsCalls

func (mock *ILogHandlerMock) GetLogsCalls() []struct {
	Params models.GetLogsParams
}

GetLogsCalls gets all the calls that were made to GetLogs. Check the length with:

len(mockedILogHandler.GetLogsCalls())

func (*ILogHandlerMock) Log

func (mock *ILogHandlerMock) Log(logs []models.LogEntry)

Log calls LogFunc.

func (*ILogHandlerMock) LogCalls

func (mock *ILogHandlerMock) LogCalls() []struct {
	Logs []models.LogEntry
}

LogCalls gets all the calls that were made to Log. Check the length with:

len(mockedILogHandler.LogCalls())

func (*ILogHandlerMock) Start

func (mock *ILogHandlerMock) Start(ctx context.Context)

Start calls StartFunc.

func (*ILogHandlerMock) StartCalls

func (mock *ILogHandlerMock) StartCalls() []struct {
	Ctx context.Context
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedILogHandler.StartCalls())

type SecretHandlerInterfaceMock

type SecretHandlerInterfaceMock struct {
	// CreateSecretFunc mocks the CreateSecret method.
	CreateSecretFunc func(secret models.Secret) error

	// DeleteSecretFunc mocks the DeleteSecret method.
	DeleteSecretFunc func(secretName string, secretScope string) error

	// GetSecretsFunc mocks the GetSecrets method.
	GetSecretsFunc func() (*models.GetSecretsResponse, error)

	// UpdateSecretFunc mocks the UpdateSecret method.
	UpdateSecretFunc func(secret models.Secret) error
	// contains filtered or unexported fields
}

SecretHandlerInterfaceMock is a mock implementation of api.SecretHandlerInterface.

func TestSomethingThatUsesSecretHandlerInterface(t *testing.T) {

	// make and configure a mocked api.SecretHandlerInterface
	mockedSecretHandlerInterface := &SecretHandlerInterfaceMock{
		CreateSecretFunc: func(secret models.Secret) error {
			panic("mock out the CreateSecret method")
		},
		DeleteSecretFunc: func(secretName string, secretScope string) error {
			panic("mock out the DeleteSecret method")
		},
		GetSecretsFunc: func() (*models.GetSecretsResponse, error) {
			panic("mock out the GetSecrets method")
		},
		UpdateSecretFunc: func(secret models.Secret) error {
			panic("mock out the UpdateSecret method")
		},
	}

	// use mockedSecretHandlerInterface in code that requires api.SecretHandlerInterface
	// and then make assertions.

}

func (*SecretHandlerInterfaceMock) CreateSecret

func (mock *SecretHandlerInterfaceMock) CreateSecret(secret models.Secret) error

CreateSecret calls CreateSecretFunc.

func (*SecretHandlerInterfaceMock) CreateSecretCalls

func (mock *SecretHandlerInterfaceMock) CreateSecretCalls() []struct {
	Secret models.Secret
}

CreateSecretCalls gets all the calls that were made to CreateSecret. Check the length with:

len(mockedSecretHandlerInterface.CreateSecretCalls())

func (*SecretHandlerInterfaceMock) DeleteSecret

func (mock *SecretHandlerInterfaceMock) DeleteSecret(secretName string, secretScope string) error

DeleteSecret calls DeleteSecretFunc.

func (*SecretHandlerInterfaceMock) DeleteSecretCalls

func (mock *SecretHandlerInterfaceMock) DeleteSecretCalls() []struct {
	SecretName  string
	SecretScope string
}

DeleteSecretCalls gets all the calls that were made to DeleteSecret. Check the length with:

len(mockedSecretHandlerInterface.DeleteSecretCalls())

func (*SecretHandlerInterfaceMock) GetSecrets

GetSecrets calls GetSecretsFunc.

func (*SecretHandlerInterfaceMock) GetSecretsCalls

func (mock *SecretHandlerInterfaceMock) GetSecretsCalls() []struct {
}

GetSecretsCalls gets all the calls that were made to GetSecrets. Check the length with:

len(mockedSecretHandlerInterface.GetSecretsCalls())

func (*SecretHandlerInterfaceMock) UpdateSecret

func (mock *SecretHandlerInterfaceMock) UpdateSecret(secret models.Secret) error

UpdateSecret calls UpdateSecretFunc.

func (*SecretHandlerInterfaceMock) UpdateSecretCalls

func (mock *SecretHandlerInterfaceMock) UpdateSecretCalls() []struct {
	Secret models.Secret
}

UpdateSecretCalls gets all the calls that were made to UpdateSecret. Check the length with:

len(mockedSecretHandlerInterface.UpdateSecretCalls())

Jump to

Keyboard shortcuts

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