utils_mock

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretHandlerInterfaceMock

type SecretHandlerInterfaceMock struct {
	// CreateSecretFunc mocks the CreateSecret method.
	CreateSecretFunc func(secret models.Secret) (string, *models.Error)

	// DeleteSecretFunc mocks the DeleteSecret method.
	DeleteSecretFunc func(secretName string, secretScope string) (string, *models.Error)

	// UpdateSecretFunc mocks the UpdateSecret method.
	UpdateSecretFunc func(secret models.Secret) (string, *models.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) (string, *models.Error) {
			panic("mock out the CreateSecret method")
		},
		DeleteSecretFunc: func(secretName string, secretScope string) (string, *models.Error) {
			panic("mock out the DeleteSecret method")
		},
		UpdateSecretFunc: func(secret models.Secret) (string, *models.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) (string, *models.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) (string, *models.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) UpdateSecret

func (mock *SecretHandlerInterfaceMock) UpdateSecret(secret models.Secret) (string, *models.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