mock

package
v2.0.0-...-ab78805 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClientMock

type APIClientMock struct {
	// HealthFunc mocks the Health method.
	HealthFunc func() (*api.HealthResponse, error)

	// ReadFunc mocks the Read method.
	ReadFunc func(path string) (*api.Secret, error)

	// SetTokenFunc mocks the SetToken method.
	SetTokenFunc func(v string)

	// WriteFunc mocks the Write method.
	WriteFunc func(path string, data map[string]interface{}) (*api.Secret, error)
	// contains filtered or unexported fields
}

APIClientMock is a mock implementation of vault.APIClient.

    func TestSomethingThatUsesAPIClient(t *testing.T) {

        // make and configure a mocked vault.APIClient
        mockedAPIClient := &APIClientMock{
            HealthFunc: func() (*api.HealthResponse, error) {
	               panic("mock out the Health method")
            },
            ReadFunc: func(path string) (*api.Secret, error) {
	               panic("mock out the Read method")
            },
            SetTokenFunc: func(v string)  {
	               panic("mock out the SetToken method")
            },
            WriteFunc: func(path string, data map[string]interface{}) (*api.Secret, error) {
	               panic("mock out the Write method")
            },
        }

        // use mockedAPIClient in code that requires vault.APIClient
        // and then make assertions.

    }

func (*APIClientMock) Health

func (mock *APIClientMock) Health() (*api.HealthResponse, error)

Health calls HealthFunc.

func (*APIClientMock) HealthCalls

func (mock *APIClientMock) HealthCalls() []struct {
}

HealthCalls gets all the calls that were made to Health. Check the length with:

len(mockedAPIClient.HealthCalls())

func (*APIClientMock) Read

func (mock *APIClientMock) Read(path string) (*api.Secret, error)

Read calls ReadFunc.

func (*APIClientMock) ReadCalls

func (mock *APIClientMock) ReadCalls() []struct {
	Path string
}

ReadCalls gets all the calls that were made to Read. Check the length with:

len(mockedAPIClient.ReadCalls())

func (*APIClientMock) SetToken

func (mock *APIClientMock) SetToken(v string)

SetToken calls SetTokenFunc.

func (*APIClientMock) SetTokenCalls

func (mock *APIClientMock) SetTokenCalls() []struct {
	V string
}

SetTokenCalls gets all the calls that were made to SetToken. Check the length with:

len(mockedAPIClient.SetTokenCalls())

func (*APIClientMock) Write

func (mock *APIClientMock) Write(path string, data map[string]interface{}) (*api.Secret, error)

Write calls WriteFunc.

func (*APIClientMock) WriteCalls

func (mock *APIClientMock) WriteCalls() []struct {
	Path string
	Data map[string]interface{}
}

WriteCalls gets all the calls that were made to Write. Check the length with:

len(mockedAPIClient.WriteCalls())

Jump to

Keyboard shortcuts

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