Documentation
¶
Index ¶
- type APIClientMock
- func (mock *APIClientMock) Health() (*api.HealthResponse, error)
- func (mock *APIClientMock) HealthCalls() []struct{}
- func (mock *APIClientMock) Read(path string) (*api.Secret, error)
- func (mock *APIClientMock) ReadCalls() []struct{ ... }
- func (mock *APIClientMock) SetToken(v string)
- func (mock *APIClientMock) SetTokenCalls() []struct{ ... }
- func (mock *APIClientMock) Write(path string, data map[string]interface{}) (*api.Secret, error)
- func (mock *APIClientMock) WriteCalls() []struct{ ... }
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) 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())
Click to show internal directories.
Click to hide internal directories.