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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PermissionsBundlerMock added in v0.5.0

type PermissionsBundlerMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context) (models.Bundle, error)
	// contains filtered or unexported fields
}

PermissionsBundlerMock is a mock implementation of api.PermissionsBundler.

    func TestSomethingThatUsesPermissionsBundler(t *testing.T) {

        // make and configure a mocked api.PermissionsBundler
        mockedPermissionsBundler := &PermissionsBundlerMock{
            GetFunc: func(ctx context.Context) (models.Bundle, error) {
	               panic("mock out the Get method")
            },
        }

        // use mockedPermissionsBundler in code that requires api.PermissionsBundler
        // and then make assertions.

    }

func (*PermissionsBundlerMock) Get added in v0.5.0

Get calls GetFunc.

func (*PermissionsBundlerMock) GetCalls added in v0.5.0

func (mock *PermissionsBundlerMock) GetCalls() []struct {
	Ctx context.Context
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedPermissionsBundler.GetCalls())

type PermissionsStoreMock

type PermissionsStoreMock struct {
	// AddPolicyFunc mocks the AddPolicy method.
	AddPolicyFunc func(ctx context.Context, policy *models.Policy) (*models.Policy, error)

	// 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

	// GetPolicyFunc mocks the GetPolicy method.
	GetPolicyFunc func(ctx context.Context, id string) (*models.Policy, error)

	// GetRoleFunc mocks the GetRole method.
	GetRoleFunc func(ctx context.Context, id string) (*models.Role, error)

	// GetRolesFunc mocks the GetRoles method.
	GetRolesFunc func(ctx context.Context, offset int, limit int) (*models.Roles, 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{
            AddPolicyFunc: func(ctx context.Context, policy *models.Policy) (*models.Policy, error) {
	               panic("mock out the AddPolicy method")
            },
            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")
            },
			   GetPolicyFunc: func(ctx context.Context, id string) (*models.Policy, error) {
				   panic("mock out the GetPolicy method")
			   },

            GetRoleFunc: func(ctx context.Context, id string) (*models.Role, error) {
	               panic("mock out the GetRole method")
            },
            GetRolesFunc: func(ctx context.Context, offset int, limit int) (*models.Roles, error) {
	               panic("mock out the GetRoles method")
            },
        }

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

    }

func (*PermissionsStoreMock) AddPolicy added in v0.5.0

func (mock *PermissionsStoreMock) AddPolicy(ctx context.Context, policy *models.Policy) (*models.Policy, error)

AddPolicy calls AddPolicyFunc.

func (*PermissionsStoreMock) AddPolicyCalls added in v0.5.0

func (mock *PermissionsStoreMock) AddPolicyCalls() []struct {
	Ctx    context.Context
	Policy *models.Policy
}

AddPolicyCalls gets all the calls that were made to AddPolicy. Check the length with:

len(mockedPermissionsStore.AddPolicyCalls())

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) GetPolicy added in v0.5.0

func (mock *PermissionsStoreMock) GetPolicy(ctx context.Context, id string) (*models.Policy, error)

GetPolicy calls GetPolicyFunc.

func (*PermissionsStoreMock) GetPolicyCalls added in v0.5.0

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

GetPolicyCalls gets all the calls that were made to GetPolicy. Check the length with:

len(mockedPermissionsStore.GetPolicyCalls())

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())

func (*PermissionsStoreMock) GetRoles added in v0.4.0

func (mock *PermissionsStoreMock) GetRoles(ctx context.Context, offset int, limit int) (*models.Roles, error)

GetRoles calls GetRolesFunc.

func (*PermissionsStoreMock) GetRolesCalls added in v0.4.0

func (mock *PermissionsStoreMock) GetRolesCalls() []struct {
	Ctx    context.Context
	Offset int
	Limit  int
}

GetRolesCalls gets all the calls that were made to GetRoles. Check the length with:

len(mockedPermissionsStore.GetRolesCalls())

Jump to

Keyboard shortcuts

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