Documentation
¶
Index ¶
- type CacheMock
- func (mock *CacheMock) Close(ctx context.Context) error
- func (mock *CacheMock) CloseCalls() []struct{ ... }
- func (mock *CacheMock) GetPermissionsBundle(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error)
- func (mock *CacheMock) GetPermissionsBundleCalls() []struct{ ... }
- func (mock *CacheMock) HealthCheck(ctx context.Context, state *health.CheckState) error
- func (mock *CacheMock) HealthCheckCalls() []struct{ ... }
- type StoreMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheMock ¶
type CacheMock struct {
// CloseFunc mocks the Close method.
CloseFunc func(ctx context.Context) error
// GetPermissionsBundleFunc mocks the GetPermissionsBundle method.
GetPermissionsBundleFunc func(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error)
// HealthCheckFunc mocks the HealthCheck method.
HealthCheckFunc func(ctx context.Context, state *health.CheckState) error
// contains filtered or unexported fields
}
CacheMock is a mock implementation of permissions.Cache.
func TestSomethingThatUsesCache(t *testing.T) {
// make and configure a mocked permissions.Cache
mockedCache := &CacheMock{
CloseFunc: func(ctx context.Context) error {
panic("mock out the Close method")
},
GetPermissionsBundleFunc: func(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error) {
panic("mock out the GetPermissionsBundle method")
},
HealthCheckFunc: func(ctx context.Context, state *health.CheckState) error {
panic("mock out the HealthCheck method")
},
}
// use mockedCache in code that requires permissions.Cache
// and then make assertions.
}
func (*CacheMock) CloseCalls ¶
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedCache.CloseCalls())
func (*CacheMock) GetPermissionsBundle ¶
func (mock *CacheMock) GetPermissionsBundle(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error)
GetPermissionsBundle calls GetPermissionsBundleFunc.
func (*CacheMock) GetPermissionsBundleCalls ¶
func (mock *CacheMock) GetPermissionsBundleCalls() []struct { Ctx context.Context Headers permsdk.Headers }
GetPermissionsBundleCalls gets all the calls that were made to GetPermissionsBundle. Check the length with:
len(mockedCache.GetPermissionsBundleCalls())
func (*CacheMock) HealthCheck ¶
HealthCheck calls HealthCheckFunc.
func (*CacheMock) HealthCheckCalls ¶
func (mock *CacheMock) HealthCheckCalls() []struct { Ctx context.Context State *health.CheckState }
HealthCheckCalls gets all the calls that were made to HealthCheck. Check the length with:
len(mockedCache.HealthCheckCalls())
type StoreMock ¶
type StoreMock struct {
// GetPermissionsBundleFunc mocks the GetPermissionsBundle method.
GetPermissionsBundleFunc func(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error)
// contains filtered or unexported fields
}
StoreMock is a mock implementation of permissions.Store.
func TestSomethingThatUsesStore(t *testing.T) {
// make and configure a mocked permissions.Store
mockedStore := &StoreMock{
GetPermissionsBundleFunc: func(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error) {
panic("mock out the GetPermissionsBundle method")
},
}
// use mockedStore in code that requires permissions.Store
// and then make assertions.
}
func (*StoreMock) GetPermissionsBundle ¶
func (mock *StoreMock) GetPermissionsBundle(ctx context.Context, headers permsdk.Headers) (permsdk.Bundle, error)
GetPermissionsBundle calls GetPermissionsBundleFunc.
func (*StoreMock) GetPermissionsBundleCalls ¶
func (mock *StoreMock) GetPermissionsBundleCalls() []struct { Ctx context.Context Headers permsdk.Headers }
GetPermissionsBundleCalls gets all the calls that were made to GetPermissionsBundle. Check the length with:
len(mockedStore.GetPermissionsBundleCalls())