mock

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StoreMock

type StoreMock struct {
	// GetAllBundlePoliciesFunc mocks the GetAllBundlePolicies method.
	GetAllBundlePoliciesFunc func(ctx context.Context) ([]*models.BundlePolicy, error)

	// GetAllRolesFunc mocks the GetAllRoles method.
	GetAllRolesFunc func(ctx context.Context) ([]*models.Role, 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{
            GetAllBundlePoliciesFunc: func(ctx context.Context) ([]*models.BundlePolicy, error) {
	               panic("mock out the GetAllBundlePolicies method")
            },
            GetAllRolesFunc: func(ctx context.Context) ([]*models.Role, error) {
	               panic("mock out the GetAllRoles method")
            },
        }

        // use mockedStore in code that requires permissions.Store
        // and then make assertions.

    }

func (*StoreMock) GetAllBundlePolicies

func (mock *StoreMock) GetAllBundlePolicies(ctx context.Context) ([]*models.BundlePolicy, error)

GetAllBundlePolicies calls GetAllBundlePoliciesFunc.

func (*StoreMock) GetAllBundlePoliciesCalls

func (mock *StoreMock) GetAllBundlePoliciesCalls() []struct {
	Ctx context.Context
}

GetAllBundlePoliciesCalls gets all the calls that were made to GetAllBundlePolicies. Check the length with:

len(mockedStore.GetAllBundlePoliciesCalls())

func (*StoreMock) GetAllRoles

func (mock *StoreMock) GetAllRoles(ctx context.Context) ([]*models.Role, error)

GetAllRoles calls GetAllRolesFunc.

func (*StoreMock) GetAllRolesCalls

func (mock *StoreMock) GetAllRolesCalls() []struct {
	Ctx context.Context
}

GetAllRolesCalls gets all the calls that were made to GetAllRoles. Check the length with:

len(mockedStore.GetAllRolesCalls())

Jump to

Keyboard shortcuts

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