Service accounts: Split user and service account database (#46442)
* ServiceAccounts: remove unused endpoint * ServiceAccounts: remove usage of getOrgUsers from service accounts * use dialect for boolean str true in delete * return service account results directly * Move Service Account Deletions to sa package Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> Co-authored-by: gamab <gabi.mabs@gmail.com> * Move service account methods to service accounts Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> Co-authored-by: gamab <gabi.mabs@gmail.com> * Service accounts should not interfere with users Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * filter service accounts in user services * mispell fix * fix overextended lines Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * fix variable Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> Co-authored-by: gamab <gabi.mabs@gmail.com>
This commit is contained in:
co-authored by
Gabriel MABILLE
gamab
parent
99b4dfc27d
commit
ef9fe26886
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestStore_CreateServiceAccount(t *testing.T) {
|
||||
sqlStore, store := setupTestDatabase(t)
|
||||
_, store := setupTestDatabase(t)
|
||||
t.Run("create service account", func(t *testing.T) {
|
||||
saDTO, err := store.CreateServiceAccount(context.Background(), 1, "new Service Account")
|
||||
require.NoError(t, err)
|
||||
@@ -21,17 +21,11 @@ func TestStore_CreateServiceAccount(t *testing.T) {
|
||||
assert.Equal(t, "new Service Account", saDTO.Name)
|
||||
assert.Equal(t, 0, int(saDTO.Tokens))
|
||||
|
||||
query := models.GetUserByIdQuery{Id: saDTO.Id}
|
||||
err = sqlStore.GetUserById(context.Background(), &query)
|
||||
retrieved := query.Result
|
||||
retrieved, err := store.RetrieveServiceAccount(context.Background(), 1, saDTO.Id)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "sa-new-service-account", retrieved.Login)
|
||||
assert.Equal(t, "new Service Account", retrieved.Name)
|
||||
assert.Equal(t, "sa-new-service-account", retrieved.Email)
|
||||
assert.Equal(t, "", retrieved.Password)
|
||||
assert.Equal(t, 1, int(retrieved.OrgId))
|
||||
assert.Len(t, retrieved.Salt, 10)
|
||||
assert.Equal(t, true, retrieved.IsServiceAccount)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user