Documentation
¶
Index ¶
- type AuthProviderMock
- func (mock *AuthProviderMock) Enabled() bool
- func (mock *AuthProviderMock) EnabledCalls() []struct{}
- func (mock *AuthProviderMock) FilterKeysForRequest(r *http.Request, keys []string) []string
- func (mock *AuthProviderMock) FilterKeysForRequestCalls() []struct{ ... }
- func (mock *AuthProviderMock) GetRequestActor(r *http.Request) (string, string)
- func (mock *AuthProviderMock) GetRequestActorCalls() []struct{ ... }
- type EventPublisherMock
- type FormatValidatorMock
- type GitServiceMock
- func (mock *GitServiceMock) Commit(req git.CommitRequest) error
- func (mock *GitServiceMock) CommitCalls() []struct{ ... }
- func (mock *GitServiceMock) Delete(key string, author git.Author) error
- func (mock *GitServiceMock) DeleteCalls() []struct{ ... }
- func (mock *GitServiceMock) GetRevision(key string, rev string) ([]byte, string, error)
- func (mock *GitServiceMock) GetRevisionCalls() []struct{ ... }
- func (mock *GitServiceMock) History(key string, limit int) ([]git.HistoryEntry, error)
- func (mock *GitServiceMock) HistoryCalls() []struct{ ... }
- type KVStoreMock
- func (mock *KVStoreMock) Delete(ctx context.Context, key string) error
- func (mock *KVStoreMock) DeleteCalls() []struct{ ... }
- func (mock *KVStoreMock) Get(ctx context.Context, key string) ([]byte, error)
- func (mock *KVStoreMock) GetCalls() []struct{ ... }
- func (mock *KVStoreMock) GetWithFormat(ctx context.Context, key string) ([]byte, string, error)
- func (mock *KVStoreMock) GetWithFormatCalls() []struct{ ... }
- func (mock *KVStoreMock) List(ctx context.Context, filter enum.SecretsFilter) ([]store.KeyInfo, error)
- func (mock *KVStoreMock) ListCalls() []struct{ ... }
- func (mock *KVStoreMock) SecretsEnabled() bool
- func (mock *KVStoreMock) SecretsEnabledCalls() []struct{}
- func (mock *KVStoreMock) Set(ctx context.Context, key string, value []byte, format string) (bool, error)
- func (mock *KVStoreMock) SetCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthProviderMock ¶
type AuthProviderMock struct {
// EnabledFunc mocks the Enabled method.
EnabledFunc func() bool
// FilterKeysForRequestFunc mocks the FilterKeysForRequest method.
FilterKeysForRequestFunc func(r *http.Request, keys []string) []string
// GetRequestActorFunc mocks the GetRequestActor method.
GetRequestActorFunc func(r *http.Request) (string, string)
// contains filtered or unexported fields
}
AuthProviderMock is a mock implementation of api.AuthProvider.
func TestSomethingThatUsesAuthProvider(t *testing.T) {
// make and configure a mocked api.AuthProvider
mockedAuthProvider := &AuthProviderMock{
EnabledFunc: func() bool {
panic("mock out the Enabled method")
},
FilterKeysForRequestFunc: func(r *http.Request, keys []string) []string {
panic("mock out the FilterKeysForRequest method")
},
GetRequestActorFunc: func(r *http.Request) (string, string) {
panic("mock out the GetRequestActor method")
},
}
// use mockedAuthProvider in code that requires api.AuthProvider
// and then make assertions.
}
func (*AuthProviderMock) Enabled ¶
func (mock *AuthProviderMock) Enabled() bool
Enabled calls EnabledFunc.
func (*AuthProviderMock) EnabledCalls ¶
func (mock *AuthProviderMock) EnabledCalls() []struct { }
EnabledCalls gets all the calls that were made to Enabled. Check the length with:
len(mockedAuthProvider.EnabledCalls())
func (*AuthProviderMock) FilterKeysForRequest ¶ added in v0.18.0
func (mock *AuthProviderMock) FilterKeysForRequest(r *http.Request, keys []string) []string
FilterKeysForRequest calls FilterKeysForRequestFunc.
func (*AuthProviderMock) FilterKeysForRequestCalls ¶ added in v0.18.0
func (mock *AuthProviderMock) FilterKeysForRequestCalls() []struct { R *http.Request Keys []string }
FilterKeysForRequestCalls gets all the calls that were made to FilterKeysForRequest. Check the length with:
len(mockedAuthProvider.FilterKeysForRequestCalls())
func (*AuthProviderMock) GetRequestActor ¶ added in v0.18.0
func (mock *AuthProviderMock) GetRequestActor(r *http.Request) (string, string)
GetRequestActor calls GetRequestActorFunc.
func (*AuthProviderMock) GetRequestActorCalls ¶ added in v0.18.0
func (mock *AuthProviderMock) GetRequestActorCalls() []struct { R *http.Request }
GetRequestActorCalls gets all the calls that were made to GetRequestActor. Check the length with:
len(mockedAuthProvider.GetRequestActorCalls())
type EventPublisherMock ¶ added in v0.19.0
type EventPublisherMock struct {
// PublishFunc mocks the Publish method.
PublishFunc func(key string, action enum.AuditAction)
// contains filtered or unexported fields
}
EventPublisherMock is a mock implementation of api.EventPublisher.
func TestSomethingThatUsesEventPublisher(t *testing.T) {
// make and configure a mocked api.EventPublisher
mockedEventPublisher := &EventPublisherMock{
PublishFunc: func(key string, action enum.AuditAction) {
panic("mock out the Publish method")
},
}
// use mockedEventPublisher in code that requires api.EventPublisher
// and then make assertions.
}
func (*EventPublisherMock) Publish ¶ added in v0.19.0
func (mock *EventPublisherMock) Publish(key string, action enum.AuditAction)
Publish calls PublishFunc.
func (*EventPublisherMock) PublishCalls ¶ added in v0.19.0
func (mock *EventPublisherMock) PublishCalls() []struct { Key string Action enum.AuditAction }
PublishCalls gets all the calls that were made to Publish. Check the length with:
len(mockedEventPublisher.PublishCalls())
type FormatValidatorMock ¶
type FormatValidatorMock struct {
// IsValidFormatFunc mocks the IsValidFormat method.
IsValidFormatFunc func(format string) bool
// contains filtered or unexported fields
}
FormatValidatorMock is a mock implementation of api.FormatValidator.
func TestSomethingThatUsesFormatValidator(t *testing.T) {
// make and configure a mocked api.FormatValidator
mockedFormatValidator := &FormatValidatorMock{
IsValidFormatFunc: func(format string) bool {
panic("mock out the IsValidFormat method")
},
}
// use mockedFormatValidator in code that requires api.FormatValidator
// and then make assertions.
}
func (*FormatValidatorMock) IsValidFormat ¶
func (mock *FormatValidatorMock) IsValidFormat(format string) bool
IsValidFormat calls IsValidFormatFunc.
func (*FormatValidatorMock) IsValidFormatCalls ¶
func (mock *FormatValidatorMock) IsValidFormatCalls() []struct { Format string }
IsValidFormatCalls gets all the calls that were made to IsValidFormat. Check the length with:
len(mockedFormatValidator.IsValidFormatCalls())
type GitServiceMock ¶
type GitServiceMock struct {
// CommitFunc mocks the Commit method.
CommitFunc func(req git.CommitRequest) error
// DeleteFunc mocks the Delete method.
DeleteFunc func(key string, author git.Author) error
// GetRevisionFunc mocks the GetRevision method.
GetRevisionFunc func(key string, rev string) ([]byte, string, error)
// HistoryFunc mocks the History method.
HistoryFunc func(key string, limit int) ([]git.HistoryEntry, error)
// contains filtered or unexported fields
}
GitServiceMock is a mock implementation of api.GitService.
func TestSomethingThatUsesGitService(t *testing.T) {
// make and configure a mocked api.GitService
mockedGitService := &GitServiceMock{
CommitFunc: func(req git.CommitRequest) error {
panic("mock out the Commit method")
},
DeleteFunc: func(key string, author git.Author) error {
panic("mock out the Delete method")
},
GetRevisionFunc: func(key string, rev string) ([]byte, string, error) {
panic("mock out the GetRevision method")
},
HistoryFunc: func(key string, limit int) ([]git.HistoryEntry, error) {
panic("mock out the History method")
},
}
// use mockedGitService in code that requires api.GitService
// and then make assertions.
}
func (*GitServiceMock) Commit ¶
func (mock *GitServiceMock) Commit(req git.CommitRequest) error
Commit calls CommitFunc.
func (*GitServiceMock) CommitCalls ¶
func (mock *GitServiceMock) CommitCalls() []struct { Req git.CommitRequest }
CommitCalls gets all the calls that were made to Commit. Check the length with:
len(mockedGitService.CommitCalls())
func (*GitServiceMock) Delete ¶
func (mock *GitServiceMock) Delete(key string, author git.Author) error
Delete calls DeleteFunc.
func (*GitServiceMock) DeleteCalls ¶
func (mock *GitServiceMock) DeleteCalls() []struct { Key string Author git.Author }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedGitService.DeleteCalls())
func (*GitServiceMock) GetRevision ¶ added in v0.12.0
GetRevision calls GetRevisionFunc.
func (*GitServiceMock) GetRevisionCalls ¶ added in v0.12.0
func (mock *GitServiceMock) GetRevisionCalls() []struct { Key string Rev string }
GetRevisionCalls gets all the calls that were made to GetRevision. Check the length with:
len(mockedGitService.GetRevisionCalls())
func (*GitServiceMock) History ¶ added in v0.12.0
func (mock *GitServiceMock) History(key string, limit int) ([]git.HistoryEntry, error)
History calls HistoryFunc.
func (*GitServiceMock) HistoryCalls ¶ added in v0.12.0
func (mock *GitServiceMock) HistoryCalls() []struct { Key string Limit int }
HistoryCalls gets all the calls that were made to History. Check the length with:
len(mockedGitService.HistoryCalls())
type KVStoreMock ¶
type KVStoreMock struct {
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, key string) error
// GetFunc mocks the Get method.
GetFunc func(ctx context.Context, key string) ([]byte, error)
// GetWithFormatFunc mocks the GetWithFormat method.
GetWithFormatFunc func(ctx context.Context, key string) ([]byte, string, error)
// ListFunc mocks the List method.
ListFunc func(ctx context.Context, filter enum.SecretsFilter) ([]store.KeyInfo, error)
// SecretsEnabledFunc mocks the SecretsEnabled method.
SecretsEnabledFunc func() bool
// SetFunc mocks the Set method.
SetFunc func(ctx context.Context, key string, value []byte, format string) (bool, error)
// contains filtered or unexported fields
}
KVStoreMock is a mock implementation of api.KVStore.
func TestSomethingThatUsesKVStore(t *testing.T) {
// make and configure a mocked api.KVStore
mockedKVStore := &KVStoreMock{
DeleteFunc: func(ctx context.Context, key string) error {
panic("mock out the Delete method")
},
GetFunc: func(ctx context.Context, key string) ([]byte, error) {
panic("mock out the Get method")
},
GetWithFormatFunc: func(ctx context.Context, key string) ([]byte, string, error) {
panic("mock out the GetWithFormat method")
},
ListFunc: func(ctx context.Context, filter enum.SecretsFilter) ([]store.KeyInfo, error) {
panic("mock out the List method")
},
SecretsEnabledFunc: func() bool {
panic("mock out the SecretsEnabled method")
},
SetFunc: func(ctx context.Context, key string, value []byte, format string) (bool, error) {
panic("mock out the Set method")
},
}
// use mockedKVStore in code that requires api.KVStore
// and then make assertions.
}
func (*KVStoreMock) Delete ¶
func (mock *KVStoreMock) Delete(ctx context.Context, key string) error
Delete calls DeleteFunc.
func (*KVStoreMock) DeleteCalls ¶
func (mock *KVStoreMock) DeleteCalls() []struct { Ctx context.Context Key string }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedKVStore.DeleteCalls())
func (*KVStoreMock) GetCalls ¶
func (mock *KVStoreMock) GetCalls() []struct { Ctx context.Context Key string }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedKVStore.GetCalls())
func (*KVStoreMock) GetWithFormat ¶
GetWithFormat calls GetWithFormatFunc.
func (*KVStoreMock) GetWithFormatCalls ¶
func (mock *KVStoreMock) GetWithFormatCalls() []struct { Ctx context.Context Key string }
GetWithFormatCalls gets all the calls that were made to GetWithFormat. Check the length with:
len(mockedKVStore.GetWithFormatCalls())
func (*KVStoreMock) List ¶
func (mock *KVStoreMock) List(ctx context.Context, filter enum.SecretsFilter) ([]store.KeyInfo, error)
List calls ListFunc.
func (*KVStoreMock) ListCalls ¶
func (mock *KVStoreMock) ListCalls() []struct { Ctx context.Context Filter enum.SecretsFilter }
ListCalls gets all the calls that were made to List. Check the length with:
len(mockedKVStore.ListCalls())
func (*KVStoreMock) SecretsEnabled ¶ added in v0.15.0
func (mock *KVStoreMock) SecretsEnabled() bool
SecretsEnabled calls SecretsEnabledFunc.
func (*KVStoreMock) SecretsEnabledCalls ¶ added in v0.15.0
func (mock *KVStoreMock) SecretsEnabledCalls() []struct { }
SecretsEnabledCalls gets all the calls that were made to SecretsEnabled. Check the length with:
len(mockedKVStore.SecretsEnabledCalls())