Documentation ¶
Index ¶
- func SetupApiKey(t *testing.T, store db.DB, cfg *setting.Cfg, testKey TestApiKey) *apikey.APIKey
- func SetupUserServiceAccount(t *testing.T, db db.DB, cfg *setting.Cfg, testUser TestUser) *user.User
- func SetupUsersServiceAccounts(t *testing.T, sqlStore db.DB, cfg *setting.Cfg, testUsers []TestUser) (orgID int64)
- type FakeServiceAccountService
- func (f *FakeServiceAccountService) AddServiceAccountToken(ctx context.Context, id int64, ...) (*apikey.APIKey, error)
- func (f *FakeServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, ...) (*serviceaccounts.ServiceAccountDTO, error)
- func (f *FakeServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID, id int64) error
- func (f *FakeServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID, id, tokenID int64) error
- func (f *FakeServiceAccountService) EnableServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, enable bool) error
- func (f *FakeServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
- func (f *FakeServiceAccountService) MigrateApiKey(ctx context.Context, orgID, keyID int64) error
- func (f *FakeServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error)
- func (f *FakeServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID, id int64) (*serviceaccounts.ServiceAccountProfileDTO, error)
- func (f *FakeServiceAccountService) RetrieveServiceAccountIdByName(ctx context.Context, orgID int64, name string) (int64, error)
- func (f *FakeServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)
- func (f *FakeServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID, id int64, ...) (*serviceaccounts.ServiceAccountProfileDTO, error)
- type MockExtSvcAccountsService
- func (_m *MockExtSvcAccountsService) EnableExtSvcAccount(ctx context.Context, cmd *serviceaccounts.EnableExtSvcAccountCmd) error
- func (_m *MockExtSvcAccountsService) ManageExtSvcAccount(ctx context.Context, cmd *serviceaccounts.ManageExtSvcAccountCmd) (int64, error)
- func (_m *MockExtSvcAccountsService) RemoveExtSvcAccount(ctx context.Context, orgID int64, extSvcSlug string) error
- func (_m *MockExtSvcAccountsService) RetrieveExtSvcAccount(ctx context.Context, orgID int64, saID int64) (*serviceaccounts.ExtSvcAccount, error)
- type MockServiceAccountService
- func (_m *MockServiceAccountService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, ...) (*apikey.APIKey, error)
- func (_m *MockServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, ...) (*serviceaccounts.ServiceAccountDTO, error)
- func (_m *MockServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) error
- func (_m *MockServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID int64, serviceAccountID int64, tokenID int64) error
- func (_m *MockServiceAccountService) EnableServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, enable bool) error
- func (_m *MockServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
- func (_m *MockServiceAccountService) MigrateApiKey(ctx context.Context, orgID int64, keyId int64) error
- func (_m *MockServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error)
- func (_m *MockServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) (*serviceaccounts.ServiceAccountProfileDTO, error)
- func (_m *MockServiceAccountService) RetrieveServiceAccountIdByName(ctx context.Context, orgID int64, name string) (int64, error)
- func (_m *MockServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)
- func (_m *MockServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, ...) (*serviceaccounts.ServiceAccountProfileDTO, error)
- type TestApiKey
- type TestUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupApiKey ¶
func SetupUserServiceAccount ¶
func SetupUsersServiceAccounts ¶
func SetupUsersServiceAccounts(t *testing.T, sqlStore db.DB, cfg *setting.Cfg, testUsers []TestUser) (orgID int64)
SetupUsersServiceAccounts creates in "test org" all users or service accounts passed in parameter To achieve this, it sets the AutoAssignOrg and AutoAssignOrgId settings.
Types ¶
type FakeServiceAccountService ¶
type FakeServiceAccountService struct { ExpectedAPIKey *apikey.APIKey ExpectedErr error ExpectedMigrationResult *serviceaccounts.MigrationResult ExpectedSearchOrgServiceAccountsResult *serviceaccounts.SearchOrgServiceAccountsResult ExpectedServiceAccount *serviceaccounts.ServiceAccountDTO ExpectedServiceAccountID int64 ExpectedServiceAccountProfile *serviceaccounts.ServiceAccountProfileDTO ExpectedServiceAccountTokens []apikey.APIKey }
func (*FakeServiceAccountService) AddServiceAccountToken ¶
func (f *FakeServiceAccountService) AddServiceAccountToken(ctx context.Context, id int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error)
func (*FakeServiceAccountService) CreateServiceAccount ¶
func (f *FakeServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, saForm *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error)
func (*FakeServiceAccountService) DeleteServiceAccount ¶
func (f *FakeServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID, id int64) error
func (*FakeServiceAccountService) DeleteServiceAccountToken ¶
func (f *FakeServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID, id, tokenID int64) error
func (*FakeServiceAccountService) EnableServiceAccount ¶
func (*FakeServiceAccountService) ListTokens ¶
func (f *FakeServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
func (*FakeServiceAccountService) MigrateApiKey ¶
func (f *FakeServiceAccountService) MigrateApiKey(ctx context.Context, orgID, keyID int64) error
func (*FakeServiceAccountService) MigrateApiKeysToServiceAccounts ¶
func (f *FakeServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error)
func (*FakeServiceAccountService) RetrieveServiceAccount ¶
func (f *FakeServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID, id int64) (*serviceaccounts.ServiceAccountProfileDTO, error)
func (*FakeServiceAccountService) RetrieveServiceAccountIdByName ¶
func (*FakeServiceAccountService) SearchOrgServiceAccounts ¶
func (f *FakeServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)
func (*FakeServiceAccountService) UpdateServiceAccount ¶
func (f *FakeServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID, id int64, cmd *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error)
type MockExtSvcAccountsService ¶
MockExtSvcAccountsService is an autogenerated mock type for the ExtSvcAccountsService type
func NewMockExtSvcAccountsService ¶
func NewMockExtSvcAccountsService(t interface { mock.TestingT Cleanup(func()) }) *MockExtSvcAccountsService
NewMockExtSvcAccountsService creates a new instance of MockExtSvcAccountsService. 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 (*MockExtSvcAccountsService) EnableExtSvcAccount ¶
func (_m *MockExtSvcAccountsService) EnableExtSvcAccount(ctx context.Context, cmd *serviceaccounts.EnableExtSvcAccountCmd) error
EnableExtSvcAccount provides a mock function with given fields: ctx, cmd
func (*MockExtSvcAccountsService) ManageExtSvcAccount ¶
func (_m *MockExtSvcAccountsService) ManageExtSvcAccount(ctx context.Context, cmd *serviceaccounts.ManageExtSvcAccountCmd) (int64, error)
ManageExtSvcAccount provides a mock function with given fields: ctx, cmd
func (*MockExtSvcAccountsService) RemoveExtSvcAccount ¶
func (_m *MockExtSvcAccountsService) RemoveExtSvcAccount(ctx context.Context, orgID int64, extSvcSlug string) error
RemoveExtSvcAccount provides a mock function with given fields: ctx, orgID, extSvcSlug
func (*MockExtSvcAccountsService) RetrieveExtSvcAccount ¶
func (_m *MockExtSvcAccountsService) RetrieveExtSvcAccount(ctx context.Context, orgID int64, saID int64) (*serviceaccounts.ExtSvcAccount, error)
RetrieveExtSvcAccount provides a mock function with given fields: ctx, orgID, saID
type MockServiceAccountService ¶
MockServiceAccountService is an autogenerated mock type for the Service type
func NewMockServiceAccountService ¶
func NewMockServiceAccountService(t interface { mock.TestingT Cleanup(func()) }) *MockServiceAccountService
NewMockServiceAccountService creates a new instance of MockServiceAccountService. 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 (*MockServiceAccountService) AddServiceAccountToken ¶
func (_m *MockServiceAccountService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error)
AddServiceAccountToken provides a mock function with given fields: ctx, serviceAccountID, cmd
func (*MockServiceAccountService) CreateServiceAccount ¶
func (_m *MockServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, saForm *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error)
CreateServiceAccount provides a mock function with given fields: ctx, orgID, saForm
func (*MockServiceAccountService) DeleteServiceAccount ¶
func (_m *MockServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) error
DeleteServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID
func (*MockServiceAccountService) DeleteServiceAccountToken ¶
func (_m *MockServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID int64, serviceAccountID int64, tokenID int64) error
DeleteServiceAccountToken provides a mock function with given fields: ctx, orgID, serviceAccountID, tokenID
func (*MockServiceAccountService) EnableServiceAccount ¶
func (_m *MockServiceAccountService) EnableServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, enable bool) error
EnableServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, enable
func (*MockServiceAccountService) ListTokens ¶
func (_m *MockServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
ListTokens provides a mock function with given fields: ctx, query
func (*MockServiceAccountService) MigrateApiKey ¶
func (_m *MockServiceAccountService) MigrateApiKey(ctx context.Context, orgID int64, keyId int64) error
MigrateApiKey provides a mock function with given fields: ctx, orgID, keyId
func (*MockServiceAccountService) MigrateApiKeysToServiceAccounts ¶
func (_m *MockServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error)
MigrateApiKeysToServiceAccounts provides a mock function with given fields: ctx, orgID
func (*MockServiceAccountService) RetrieveServiceAccount ¶
func (_m *MockServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) (*serviceaccounts.ServiceAccountProfileDTO, error)
RetrieveServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID
func (*MockServiceAccountService) RetrieveServiceAccountIdByName ¶
func (_m *MockServiceAccountService) RetrieveServiceAccountIdByName(ctx context.Context, orgID int64, name string) (int64, error)
RetrieveServiceAccountIdByName provides a mock function with given fields: ctx, orgID, name
func (*MockServiceAccountService) SearchOrgServiceAccounts ¶
func (_m *MockServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)
SearchOrgServiceAccounts provides a mock function with given fields: ctx, query
func (*MockServiceAccountService) UpdateServiceAccount ¶
func (_m *MockServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, saForm *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error)
UpdateServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, saForm