mock

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 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

	// DeletePolicyFunc mocks the DeletePolicy method.
	DeletePolicyFunc func(ctx context.Context, id string) 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)

	// UpdatePolicyFunc mocks the UpdatePolicy method.
	UpdatePolicyFunc func(ctx context.Context, policy *models.Policy) (*models.UpdateResult, 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")
		},
		DeletePolicyFunc: func(ctx context.Context, id string) error {
			panic("mock out the DeletePolicy 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")
		},
		UpdatePolicyFunc: func(ctx context.Context, policy *models.Policy) (*models.UpdateResult, error) {
			panic("mock out the UpdatePolicy 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) DeletePolicy added in v0.8.0

func (mock *PermissionsStoreMock) DeletePolicy(ctx context.Context, id string) error

DeletePolicy calls DeletePolicyFunc.

func (*PermissionsStoreMock) DeletePolicyCalls added in v0.8.0

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

DeletePolicyCalls gets all the calls that were made to DeletePolicy. Check the length with:

len(mockedPermissionsStore.DeletePolicyCalls())

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

func (*PermissionsStoreMock) UpdatePolicy added in v0.8.0

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

UpdatePolicy calls UpdatePolicyFunc.

func (*PermissionsStoreMock) UpdatePolicyCalls added in v0.8.0

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

UpdatePolicyCalls gets all the calls that were made to UpdatePolicy. Check the length with:

len(mockedPermissionsStore.UpdatePolicyCalls())

Jump to

Keyboard shortcuts

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