mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Move team store implementation to a separate package (#55514)
* Chore: move team store implementation to a separate package * trying to fix more tests * fix tests in service accounts and access control * fix common tests * restore commented out test * add todos
This commit is contained in:
@@ -371,7 +371,7 @@ func setupHTTPServerWithCfgDb(
|
||||
|
||||
license := &licensing.OSSLicensingService{}
|
||||
routeRegister := routing.NewRouteRegister()
|
||||
teamService := teamimpl.ProvideService(db)
|
||||
teamService := teamimpl.ProvideService(db, cfg)
|
||||
dashboardsStore := dashboardsstore.ProvideDashboardStore(db, featuremgmt.WithFeatures(), tagimpl.ProvideService(db))
|
||||
|
||||
var acmock *accesscontrolmock.Mock
|
||||
@@ -393,7 +393,7 @@ func setupHTTPServerWithCfgDb(
|
||||
ac = acimpl.ProvideAccessControl(cfg)
|
||||
}
|
||||
|
||||
teamPermissionService, err := ossaccesscontrol.ProvideTeamPermissions(cfg, routeRegister, db, ac, license, acService)
|
||||
teamPermissionService, err := ossaccesscontrol.ProvideTeamPermissions(cfg, routeRegister, db, ac, license, acService, teamService)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create minimal HTTP Server
|
||||
|
||||
@@ -40,7 +40,8 @@ func (t *TeamGuardianMock) DeleteByUser(ctx context.Context, userID int64) error
|
||||
func setUpGetTeamMembersHandler(t *testing.T, sqlStore *sqlstore.SQLStore) {
|
||||
const testOrgID int64 = 1
|
||||
var userCmd user.CreateUserCommand
|
||||
team, err := sqlStore.CreateTeam("group1 name", "test1@test.com", testOrgID)
|
||||
teamSvc := teamimpl.ProvideService(sqlStore, setting.NewCfg())
|
||||
team, err := teamSvc.CreateTeam("group1 name", "test1@test.com", testOrgID)
|
||||
require.NoError(t, err)
|
||||
for i := 0; i < 3; i++ {
|
||||
userCmd = user.CreateUserCommand{
|
||||
@@ -51,7 +52,7 @@ func setUpGetTeamMembersHandler(t *testing.T, sqlStore *sqlstore.SQLStore) {
|
||||
// user
|
||||
user, err := sqlStore.CreateUser(context.Background(), userCmd)
|
||||
require.NoError(t, err)
|
||||
err = sqlStore.AddTeamMember(user.ID, testOrgID, team.Id, false, 1)
|
||||
err = teamSvc.AddTeamMember(user.ID, testOrgID, team.Id, false, 1)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
@@ -63,7 +64,7 @@ func TestTeamMembersAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
sqlStore.Cfg = settings
|
||||
|
||||
hs.SQLStore = sqlStore
|
||||
hs.teamService = teamimpl.ProvideService(sqlStore)
|
||||
hs.teamService = teamimpl.ProvideService(sqlStore, settings)
|
||||
hs.License = &licensing.OSSLicensingService{}
|
||||
hs.teamGuardian = &TeamGuardianMock{}
|
||||
mock := mockstore.NewSQLStoreMock()
|
||||
@@ -122,7 +123,7 @@ func createUser(db sqlstore.Store, orgId int64, t *testing.T) int64 {
|
||||
}
|
||||
|
||||
func setupTeamTestScenario(userCount int, db sqlstore.Store, t *testing.T) int64 {
|
||||
teamService := teamimpl.ProvideService(db.(*sqlstore.SQLStore)) // FIXME
|
||||
teamService := teamimpl.ProvideService(db.(*sqlstore.SQLStore), setting.NewCfg()) // FIXME
|
||||
user, err := db.CreateUser(context.Background(), user.CreateUserCommand{SkipOrgSetup: true, Login: testUserLogin})
|
||||
require.NoError(t, err)
|
||||
testOrg, err := db.CreateOrgWithMember("TestOrg", user.ID)
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestTeamAPIEndpoint(t *testing.T) {
|
||||
hs.Cfg.EditorsCanAdmin = true
|
||||
store := sqlstore.InitTestDB(t)
|
||||
store.Cfg = hs.Cfg
|
||||
hs.teamService = teamimpl.ProvideService(store)
|
||||
hs.teamService = teamimpl.ProvideService(store, hs.Cfg)
|
||||
hs.SQLStore = store
|
||||
mock := &mockstore.SQLStoreMock{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user