chore: remove CreateUser from sqlstore & replace with userService.CreateUserForTests (#59910)

This commit is contained in:
Kristin Laemmert
2022-12-07 17:03:22 +01:00
committed by GitHub
parent d036225f7b
commit 70fbf47022
44 changed files with 943 additions and 758 deletions
+10 -1
View File
@@ -11,8 +11,11 @@ import (
"path/filepath"
"testing"
"github.com/grafana/grafana/pkg/services/org/orgimpl"
"github.com/grafana/grafana/pkg/services/quota/quotaimpl"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/services/user/userimpl"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/stretchr/testify/assert"
@@ -115,7 +118,13 @@ func createUser(t *testing.T, store *sqlstore.SQLStore, cmd user.CreateUserComma
store.Cfg.AutoAssignOrg = true
store.Cfg.AutoAssignOrgId = 1
_, err := store.CreateUser(context.Background(), cmd)
quotaService := quotaimpl.ProvideService(store, store.Cfg)
orgService, err := orgimpl.ProvideService(store, store.Cfg, quotaService)
require.NoError(t, err)
usrSvc, err := userimpl.ProvideService(store, orgService, store.Cfg, nil, nil, quotaService)
require.NoError(t, err)
_, err = usrSvc.CreateUserForTests(context.Background(), &cmd)
require.NoError(t, err)
}