clean up duplicated user creation code (#50178) (#50327)

* clean up duplicated user creation code

* remove unused duplicate getOrCreateOrg function

* fix up tests

(cherry picked from commit 9350ab781c)
This commit is contained in:
Dan Cech
2022-06-13 07:12:00 -04:00
committed by GitHub
parent 5390fa57e9
commit bc2f941004
12 changed files with 49 additions and 217 deletions
+2 -3
View File
@@ -19,13 +19,12 @@ import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
)
func setUpGetOrgUsersDB(t *testing.T, sqlStore *sqlstore.SQLStore) {
setting.AutoAssignOrg = true
setting.AutoAssignOrgId = int(testOrgID)
sqlStore.Cfg.AutoAssignOrg = true
sqlStore.Cfg.AutoAssignOrgId = int(testOrgID)
_, err := sqlStore.CreateUser(context.Background(), models.CreateUserCommand{Email: "testUser@grafana.com", Login: testUserLogin})
require.NoError(t, err)