Use OrgUser method from org service (#55674)
* Use OrgUser method from org service * Use GetOrgUser from org service
This commit is contained in:
@@ -18,6 +18,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/org/orgimpl"
|
||||
"github.com/grafana/grafana/pkg/services/org/orgtest"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
|
||||
"github.com/grafana/grafana/pkg/services/temp_user/tempuserimpl"
|
||||
@@ -46,10 +48,16 @@ func TestOrgUsersAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
sqlStore := sqlstore.InitTestDB(t)
|
||||
sqlStore.Cfg = settings
|
||||
hs.SQLStore = sqlStore
|
||||
orgService := orgtest.NewOrgServiceFake()
|
||||
hs.orgService = orgService
|
||||
mock := mockstore.NewSQLStoreMock()
|
||||
loggedInUserScenario(t, "When calling GET on", "api/org/users", "api/org/users", func(sc *scenarioContext) {
|
||||
setUpGetOrgUsersDB(t, sqlStore)
|
||||
|
||||
orgService.ExpectedOrgUsers = []*org.OrgUserDTO{
|
||||
{Login: testUserLogin, Email: "testUser@grafana.com"},
|
||||
{Login: "user1", Email: "user1@grafana.com"},
|
||||
{Login: "user2", Email: "user2@grafana.com"},
|
||||
}
|
||||
sc.handlerFunc = hs.GetOrgUsersForCurrentOrg
|
||||
sc.fakeReqWithParams("GET", sc.url, map[string]string{}).exec()
|
||||
|
||||
@@ -355,6 +363,7 @@ func TestGetOrgUsersAPIEndpoint_AccessControlMetadata(t *testing.T) {
|
||||
hs.SQLStore, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, hs.SQLStore.(*sqlstore.SQLStore),
|
||||
)
|
||||
hs.orgService = orgimpl.ProvideService(hs.SQLStore, cfg)
|
||||
})
|
||||
setupOrgUsersDBForAccessControlTests(t, sc.db)
|
||||
setInitCtxSignedInUser(sc.initCtx, tc.user)
|
||||
@@ -459,6 +468,7 @@ func TestGetOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
|
||||
hs.SQLStore, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, hs.SQLStore.(*sqlstore.SQLStore),
|
||||
)
|
||||
hs.orgService = orgimpl.ProvideService(hs.SQLStore, cfg)
|
||||
})
|
||||
setInitCtxSignedInUser(sc.initCtx, tc.user)
|
||||
setupOrgUsersDBForAccessControlTests(t, sc.db)
|
||||
@@ -809,6 +819,7 @@ func TestPatchOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
|
||||
hs.SQLStore, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, hs.SQLStore.(*sqlstore.SQLStore),
|
||||
)
|
||||
hs.orgService = orgimpl.ProvideService(hs.SQLStore, cfg)
|
||||
})
|
||||
setupOrgUsersDBForAccessControlTests(t, sc.db)
|
||||
setInitCtxSignedInUser(sc.initCtx, tc.user)
|
||||
|
||||
Reference in New Issue
Block a user