mock

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PermissionsStoreMock

type PermissionsStoreMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// GetRoleFunc mocks the GetRole method.
	GetRoleFunc func(ctx context.Context, id string) (*models.Role, error)
	// contains filtered or unexported fields
}

PermissionsStoreMock is a mock implementation of api.PermissionsStore.

    func TestSomethingThatUsesPermissionsStore(t *testing.T) {

        // make and configure a mocked api.PermissionsStore
        mockedPermissionsStore := &PermissionsStoreMock{
            CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            CloseFunc: func(ctx context.Context) error {
	               panic("mock out the Close method")
            },
            GetRoleFunc: func(ctx context.Context, id string) (*models.Role, error) {
	               panic("mock out the GetRole method")
            },
        }

        // use mockedPermissionsStore in code that requires api.PermissionsStore
        // and then make assertions.

    }

func (*PermissionsStoreMock) Checker

func (mock *PermissionsStoreMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*PermissionsStoreMock) CheckerCalls

func (mock *PermissionsStoreMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedPermissionsStore.CheckerCalls())

func (*PermissionsStoreMock) Close

func (mock *PermissionsStoreMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*PermissionsStoreMock) CloseCalls

func (mock *PermissionsStoreMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedPermissionsStore.CloseCalls())

func (*PermissionsStoreMock) GetRole

func (mock *PermissionsStoreMock) GetRole(ctx context.Context, id string) (*models.Role, error)

GetRole calls GetRoleFunc.

func (*PermissionsStoreMock) GetRoleCalls

func (mock *PermissionsStoreMock) GetRoleCalls() []struct {
	Ctx context.Context
	ID  string
}

GetRoleCalls gets all the calls that were made to GetRole. Check the length with:

len(mockedPermissionsStore.GetRoleCalls())

Jump to

Keyboard shortcuts

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