actest

package
v0.0.0-kmdagger1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BatchSize = 1000
View Source
const Concurrency = 10

Variables

This section is empty.

Functions

func ConcurrentBatch

func ConcurrentBatch(workers, count, size int, eachFn func(start, end int) error) error

ConcurrentBatch spawns the requested amount of workers then ask them to run eachFn on chunks of the requested size

Types

type FakeAccessControl

type FakeAccessControl struct {
	ExpectedErr      error
	ExpectedDisabled bool
	ExpectedEvaluate bool
}

func (FakeAccessControl) Evaluate

func (f FakeAccessControl) Evaluate(ctx context.Context, user *user.SignedInUser, evaluator accesscontrol.Evaluator) (bool, error)

func (FakeAccessControl) IsDisabled

func (f FakeAccessControl) IsDisabled() bool

func (FakeAccessControl) RegisterScopeAttributeResolver

func (f FakeAccessControl) RegisterScopeAttributeResolver(prefix string, resolver accesscontrol.ScopeAttributeResolver)

type FakePermissionsService

type FakePermissionsService struct {
	ExpectedErr          error
	ExpectedPermission   *accesscontrol.ResourcePermission
	ExpectedPermissions  []accesscontrol.ResourcePermission
	ExpectedMappedAction string
}

func (*FakePermissionsService) GetPermissions

func (f *FakePermissionsService) GetPermissions(ctx context.Context, user *user.SignedInUser, resourceID string) ([]accesscontrol.ResourcePermission, error)

func (*FakePermissionsService) MapActions

func (*FakePermissionsService) SetBuiltInRolePermission

func (f *FakePermissionsService) SetBuiltInRolePermission(ctx context.Context, orgID int64, builtInRole string, resourceID string, permission string) (*accesscontrol.ResourcePermission, error)

func (*FakePermissionsService) SetPermissions

func (*FakePermissionsService) SetTeamPermission

func (f *FakePermissionsService) SetTeamPermission(ctx context.Context, orgID, teamID int64, resourceID, permission string) (*accesscontrol.ResourcePermission, error)

func (*FakePermissionsService) SetUserPermission

func (f *FakePermissionsService) SetUserPermission(ctx context.Context, orgID int64, user accesscontrol.User, resourceID, permission string) (*accesscontrol.ResourcePermission, error)

type FakeService

type FakeService struct {
	ExpectedErr                     error
	ExpectedDisabled                bool
	ExpectedCachedPermissions       bool
	ExpectedPermissions             []accesscontrol.Permission
	ExpectedFilteredUserPermissions []accesscontrol.Permission
	ExpectedUsersPermissions        map[int64][]accesscontrol.Permission
}

func (FakeService) ClearUserPermissionCache

func (f FakeService) ClearUserPermissionCache(user *user.SignedInUser)

func (FakeService) DeclareFixedRoles

func (f FakeService) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error

func (FakeService) DeleteExternalServiceRole

func (f FakeService) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error

func (FakeService) DeleteUserPermissions

func (f FakeService) DeleteUserPermissions(ctx context.Context, orgID, userID int64) error

func (FakeService) GetUsageStats

func (f FakeService) GetUsageStats(ctx context.Context) map[string]interface{}

func (FakeService) GetUserPermissions

func (f FakeService) GetUserPermissions(ctx context.Context, user *user.SignedInUser, options accesscontrol.Options) ([]accesscontrol.Permission, error)

func (FakeService) IsDisabled

func (f FakeService) IsDisabled() bool

func (FakeService) RegisterFixedRoles

func (f FakeService) RegisterFixedRoles(ctx context.Context) error

func (FakeService) SaveExternalServiceRole

func (f FakeService) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error

func (FakeService) SearchUserPermissions

func (f FakeService) SearchUserPermissions(ctx context.Context, orgID int64, searchOptions accesscontrol.SearchOptions) ([]accesscontrol.Permission, error)

func (FakeService) SearchUsersPermissions

func (f FakeService) SearchUsersPermissions(ctx context.Context, user *user.SignedInUser, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)

type FakeStore

type FakeStore struct {
	ExpectedUserPermissions  []accesscontrol.Permission
	ExpectedUsersPermissions map[int64][]accesscontrol.Permission
	ExpectedUsersRoles       map[int64][]string
	ExpectedErr              error
}

func (FakeStore) DeleteExternalServiceRole

func (f FakeStore) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error

func (FakeStore) DeleteUserPermissions

func (f FakeStore) DeleteUserPermissions(ctx context.Context, orgID, userID int64) error

func (FakeStore) GetUserPermissions

func (FakeStore) GetUsersBasicRoles

func (f FakeStore) GetUsersBasicRoles(ctx context.Context, userFilter []int64, orgID int64) (map[int64][]string, error)

func (FakeStore) SaveExternalServiceRole

func (f FakeStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error

func (FakeStore) SearchUsersPermissions

func (f FakeStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)

type MockStore

type MockStore struct {
	mock.Mock
}

MockStore is an autogenerated mock type for the store type

func NewMockStore

func NewMockStore(t mockConstructorTestingTNewMockStore) *MockStore

NewMockStore creates a new instance of MockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockStore) DeleteExternalServiceRole

func (_m *MockStore) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error

DeleteExternalServiceRole provides a mock function with given fields: ctx, externalServiceID

func (*MockStore) DeleteUserPermissions

func (_m *MockStore) DeleteUserPermissions(ctx context.Context, orgID int64, userID int64) error

DeleteUserPermissions provides a mock function with given fields: ctx, orgID, userID

func (*MockStore) GetUserPermissions

GetUserPermissions provides a mock function with given fields: ctx, query

func (*MockStore) GetUsersBasicRoles

func (_m *MockStore) GetUsersBasicRoles(ctx context.Context, userFilter []int64, orgID int64) (map[int64][]string, error)

GetUsersBasicRoles provides a mock function with given fields: ctx, userFilter, orgID

func (*MockStore) SaveExternalServiceRole

func (_m *MockStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error

SaveExternalServiceRole provides a mock function with given fields: ctx, cmd

func (*MockStore) SearchUsersPermissions

func (_m *MockStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)

SearchUsersPermissions provides a mock function with given fields: ctx, orgID, options

Jump to

Keyboard shortcuts

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