Documentation ¶
Index ¶
- type CacheMock
- func (mock *CacheMock) Close(ctx context.Context) error
- func (mock *CacheMock) CloseCalls() []struct{ ... }
- func (mock *CacheMock) GetPermissionsBundle(ctx context.Context) (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) (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) (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 ¶
GetPermissionsBundle calls GetPermissionsBundleFunc.
func (*CacheMock) GetPermissionsBundleCalls ¶
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) (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) (permsdk.Bundle, error) { panic("mock out the GetPermissionsBundle method") }, } // use mockedStore in code that requires permissions.Store // and then make assertions. }
func (*StoreMock) GetPermissionsBundle ¶
GetPermissionsBundle calls GetPermissionsBundleFunc.
func (*StoreMock) GetPermissionsBundleCalls ¶
GetPermissionsBundleCalls gets all the calls that were made to GetPermissionsBundle. Check the length with:
len(mockedStore.GetPermissionsBundleCalls())