mocks

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthZReq

type AuthZReq struct {
	Principal *models.Principal
	Verb      string
	Resources []string
}

type Authorizer added in v1.28.0

type Authorizer struct {
	mock.Mock
}

Authorizer is an autogenerated mock type for the Authorizer type

func NewAuthorizer added in v1.28.0

func NewAuthorizer(t interface {
	mock.TestingT
	Cleanup(func())
},
) *Authorizer

NewAuthorizer creates a new instance of Authorizer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Authorizer) Authorize added in v1.28.0

func (_m *Authorizer) Authorize(principal *models.Principal, verb string, resources ...string) error

Authorize provides a mock function with given fields: principal, verb, resources

func (*Authorizer) AuthorizeSilent added in v1.28.5

func (_m *Authorizer) AuthorizeSilent(principal *models.Principal, verb string, resources ...string) error

AuthorizeSilent provides a mock function with given fields: principal, verb, resources

func (*Authorizer) FilterAuthorizedResources added in v1.28.5

func (_m *Authorizer) FilterAuthorizedResources(principal *models.Principal, verb string, resources ...string) ([]string, error)

FilterAuthorizedResources provides a mock function with given fields: principal, verb, resources

type Controller added in v1.28.0

type Controller struct {
	mock.Mock
}

Controller is an autogenerated mock type for the Controller type

func NewController added in v1.28.0

func NewController(t interface {
	mock.TestingT
	Cleanup(func())
},
) *Controller

NewController creates a new instance of Controller. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Controller) AddRolesForUser added in v1.28.0

func (_m *Controller) AddRolesForUser(user string, roles []string) error

AddRolesForUser provides a mock function with given fields: user, roles

func (*Controller) DeleteRoles added in v1.28.0

func (_m *Controller) DeleteRoles(roles ...string) error

DeleteRoles provides a mock function with given fields: roles

func (*Controller) GetRoles added in v1.28.0

func (_m *Controller) GetRoles(names ...string) (map[string][]authorization.Policy, error)

GetRoles provides a mock function with given fields: names

func (*Controller) GetRolesForUser added in v1.28.0

func (_m *Controller) GetRolesForUser(user string) (map[string][]authorization.Policy, error)

GetRolesForUser provides a mock function with given fields: user

func (*Controller) GetUsersForRole added in v1.28.0

func (_m *Controller) GetUsersForRole(role string) ([]string, error)

GetUsersForRole provides a mock function with given fields: role

func (*Controller) HasPermission added in v1.28.0

func (_m *Controller) HasPermission(role string, permission *authorization.Policy) (bool, error)

HasPermission provides a mock function with given fields: role, permissions

func (*Controller) RemovePermissions added in v1.28.0

func (_m *Controller) RemovePermissions(role string, permissions []*authorization.Policy) error

RemovePermissions provides a mock function with given fields: role, permissions

func (*Controller) RevokeRolesForUser added in v1.28.0

func (_m *Controller) RevokeRolesForUser(user string, roles ...string) error

RevokeRolesForUser provides a mock function with given fields: user, roles

func (*Controller) UpsertRolesPermissions added in v1.28.0

func (_m *Controller) UpsertRolesPermissions(roles map[string][]authorization.Policy) error

UpsertRolesPermissions provides a mock function with given fields: roles

type FakeAuthorizer

type FakeAuthorizer struct {
	// contains filtered or unexported fields
}

func NewMockAuthorizer

func NewMockAuthorizer() *FakeAuthorizer

func (*FakeAuthorizer) Authorize

func (a *FakeAuthorizer) Authorize(principal *models.Principal, verb string, resources ...string) error

Authorize provides a mock function with given fields: principal, verb, resource

func (*FakeAuthorizer) AuthorizeSilent added in v1.28.5

func (a *FakeAuthorizer) AuthorizeSilent(principal *models.Principal, verb string, resources ...string) error

func (*FakeAuthorizer) Calls

func (a *FakeAuthorizer) Calls() []AuthZReq

func (*FakeAuthorizer) FilterAuthorizedResources added in v1.28.5

func (a *FakeAuthorizer) FilterAuthorizedResources(principal *models.Principal, verb string, resources ...string) ([]string, error)

func (*FakeAuthorizer) SetErr

func (a *FakeAuthorizer) SetErr(err error)

Jump to

Keyboard shortcuts

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