mocks

package
v0.0.0-...-bdb2e15 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretProviderMock

type SecretProviderMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(key string) (string, error)

	// SetFunc mocks the Set method.
	SetFunc func(key string, value string) (string, error)
	// contains filtered or unexported fields
}

SecretProviderMock is a mock implementation of secrets.SecretProvider.

func TestSomethingThatUsesSecretProvider(t *testing.T) {

	// make and configure a mocked secrets.SecretProvider
	mockedSecretProvider := &SecretProviderMock{
		GetFunc: func(key string) (string, error) {
			panic("mock out the Get method")
		},
		SetFunc: func(key string, value string) (string, error) {
			panic("mock out the Set method")
		},
	}

	// use mockedSecretProvider in code that requires secrets.SecretProvider
	// and then make assertions.

}

func (*SecretProviderMock) Get

func (mock *SecretProviderMock) Get(key string) (string, error)

Get calls GetFunc.

func (*SecretProviderMock) GetCalls

func (mock *SecretProviderMock) GetCalls() []struct {
	Key string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedSecretProvider.GetCalls())

func (*SecretProviderMock) Set

func (mock *SecretProviderMock) Set(key string, value string) (string, error)

Set calls SetFunc.

func (*SecretProviderMock) SetCalls

func (mock *SecretProviderMock) SetCalls() []struct {
	Key   string
	Value string
}

SetCalls gets all the calls that were made to Set. Check the length with:

len(mockedSecretProvider.SetCalls())

Jump to

Keyboard shortcuts

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