utils_mock

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 3 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 ILogHandlerMock added in v0.8.5

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 added in v0.8.5

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

DeleteLogs calls DeleteLogsFunc.

func (*ILogHandlerMock) DeleteLogsCalls added in v0.8.5

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 added in v0.8.5

func (mock *ILogHandlerMock) Flush() error

Flush calls FlushFunc.

func (*ILogHandlerMock) FlushCalls added in v0.8.5

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 added in v0.8.5

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

GetLogs calls GetLogsFunc.

func (*ILogHandlerMock) GetLogsCalls added in v0.8.5

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 added in v0.8.5

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

Log calls LogFunc.

func (*ILogHandlerMock) LogCalls added in v0.8.5

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 added in v0.8.5

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

Start calls StartFunc.

func (*ILogHandlerMock) StartCalls added in v0.8.5

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 added in v0.8.5

GetSecrets calls GetSecretsFunc.

func (*SecretHandlerInterfaceMock) GetSecretsCalls added in v0.8.5

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