tests

package
v0.0.85-test Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupMockAccesscontrol

func SetupMockAccesscontrol(t *testing.T,
	userpermissionsfunc func(c context.Context, siu *models.SignedInUser, opt accesscontrol.Options) ([]*accesscontrol.Permission, error),
	disableAccessControl bool) *accesscontrolmock.Mock

func SetupUserServiceAccount

func SetupUserServiceAccount(t *testing.T, sqlStore *sqlstore.SQLStore, testUser TestUser) *models.User

Types

type Calls

type Calls struct {
	CreateServiceAccount      []interface{}
	RetrieveServiceAccount    []interface{}
	DeleteServiceAccount      []interface{}
	UpgradeServiceAccounts    []interface{}
	ConvertServiceAccounts    []interface{}
	ListTokens                []interface{}
	DeleteServiceAccountToken []interface{}
	UpdateServiceAccount      []interface{}
	AddServiceAccountToken    []interface{}
	SearchOrgServiceAccounts  []interface{}
}

type ServiceAccountMock

type ServiceAccountMock struct{}

create mock for serviceaccountservice

func (*ServiceAccountMock) CreateServiceAccount

func (s *ServiceAccountMock) CreateServiceAccount(ctx context.Context, orgID int64, name string) (*serviceaccounts.ServiceAccountDTO, error)

func (*ServiceAccountMock) DeleteServiceAccount

func (s *ServiceAccountMock) DeleteServiceAccount(ctx context.Context, orgID, serviceAccountID int64) error

func (*ServiceAccountMock) Migrated

func (s *ServiceAccountMock) Migrated(ctx context.Context, orgID int64) bool

type ServiceAccountsStoreMock

type ServiceAccountsStoreMock struct {
	Calls Calls
}

func (*ServiceAccountsStoreMock) AddServiceAccountToken

func (s *ServiceAccountsStoreMock) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) error

func (*ServiceAccountsStoreMock) ConvertToServiceAccounts

func (s *ServiceAccountsStoreMock) ConvertToServiceAccounts(ctx context.Context, keys []int64) error

func (*ServiceAccountsStoreMock) CreateServiceAccount

func (s *ServiceAccountsStoreMock) CreateServiceAccount(ctx context.Context, orgID int64, name string) (*serviceaccounts.ServiceAccountDTO, error)

func (*ServiceAccountsStoreMock) DeleteServiceAccount

func (s *ServiceAccountsStoreMock) DeleteServiceAccount(ctx context.Context, orgID, serviceAccountID int64) error

func (*ServiceAccountsStoreMock) DeleteServiceAccountToken

func (s *ServiceAccountsStoreMock) DeleteServiceAccountToken(ctx context.Context, orgID, serviceAccountID, tokenID int64) error

func (*ServiceAccountsStoreMock) GetUsageMetrics

func (s *ServiceAccountsStoreMock) GetUsageMetrics(ctx context.Context) (map[string]interface{}, error)

func (*ServiceAccountsStoreMock) ListTokens

func (s *ServiceAccountsStoreMock) ListTokens(ctx context.Context, orgID int64, serviceAccount int64) ([]*models.ApiKey, error)

func (*ServiceAccountsStoreMock) RetrieveServiceAccount

func (s *ServiceAccountsStoreMock) RetrieveServiceAccount(ctx context.Context, orgID, serviceAccountID int64) (*serviceaccounts.ServiceAccountProfileDTO, error)

func (*ServiceAccountsStoreMock) SearchOrgServiceAccounts

func (*ServiceAccountsStoreMock) UpdateServiceAccount

func (s *ServiceAccountsStoreMock) UpdateServiceAccount(ctx context.Context,
	orgID, serviceAccountID int64,
	saForm *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error)

func (*ServiceAccountsStoreMock) UpgradeServiceAccounts

func (s *ServiceAccountsStoreMock) UpgradeServiceAccounts(ctx context.Context) error

type TestUser

type TestUser struct {
	Name             string
	Role             string
	Login            string
	IsServiceAccount bool
}

Jump to

Keyboard shortcuts

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