Chore: Update tests to use team membership hooks (#86846)

* update tests to use team membership hooks

* linting
This commit is contained in:
Ieva 2024-04-24 16:55:42 +01:00 committed by GitHub
parent 9e54c450d7
commit 8028d1c3e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 132 additions and 86 deletions

View File

@ -705,14 +705,12 @@ func TestIntegrationMergeUser(t *testing.T) {
return user.ErrUserNotFound
}
require.NoError(t, err)
return nil
// this is the user we want to update to another team
return teamimpl.AddOrUpdateTeamMemberHook(sess, 1, testOrgID, team1.ID, false, 0)
})
if err != nil {
t.Error(err)
}
// this is the user we want to update to another team
err = teamSvc.AddTeamMember(context.Background(), 1, testOrgID, team1.ID, false, 0)
require.NoError(t, err)
// get users
conflictUsers, err := GetUsersWithConflictingEmailsOrLogins(&cli.Context{Context: context.Background()}, sqlStore)

View File

@ -92,7 +92,7 @@ func TestAccessControlStore_GetUserPermissions(t *testing.T) {
t.Run(tt.desc, func(t *testing.T) {
store, permissionStore, sql, teamSvc, _ := setupTestEnv(t)
user, team := createUserAndTeam(t, sql, teamSvc, tt.orgID)
user, team := createUserAndTeam(t, store.sql, sql, teamSvc, tt.orgID)
for _, id := range tt.userPermissions {
_, err := permissionStore.SetUserResourcePermission(context.Background(), tt.orgID, accesscontrol.User{ID: user.ID}, rs.SetResourcePermissionCommand{
@ -164,7 +164,7 @@ func TestAccessControlStore_GetUserPermissions(t *testing.T) {
func TestAccessControlStore_DeleteUserPermissions(t *testing.T) {
t.Run("expect permissions in all orgs to be deleted", func(t *testing.T) {
store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
user, _ := createUserAndTeam(t, sql, teamSvc, 1)
user, _ := createUserAndTeam(t, store.sql, sql, teamSvc, 1)
// generate permissions in org 1
_, err := permissionsStore.SetUserResourcePermission(context.Background(), 1, accesscontrol.User{ID: user.ID}, rs.SetResourcePermissionCommand{
@ -204,7 +204,7 @@ func TestAccessControlStore_DeleteUserPermissions(t *testing.T) {
t.Run("expect permissions in org 1 to be deleted", func(t *testing.T) {
store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
user, _ := createUserAndTeam(t, sql, teamSvc, 1)
user, _ := createUserAndTeam(t, store.sql, sql, teamSvc, 1)
// generate permissions in org 1
_, err := permissionsStore.SetUserResourcePermission(context.Background(), 1, accesscontrol.User{ID: user.ID}, rs.SetResourcePermissionCommand{
@ -246,7 +246,7 @@ func TestAccessControlStore_DeleteUserPermissions(t *testing.T) {
func TestAccessControlStore_DeleteTeamPermissions(t *testing.T) {
t.Run("expect permissions related to team to be deleted", func(t *testing.T) {
store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
user, team := createUserAndTeam(t, sql, teamSvc, 1)
user, team := createUserAndTeam(t, store.sql, sql, teamSvc, 1)
// grant permission to the team
_, err := permissionsStore.SetTeamResourcePermission(context.Background(), 1, team.ID, rs.SetResourcePermissionCommand{
@ -280,7 +280,7 @@ func TestAccessControlStore_DeleteTeamPermissions(t *testing.T) {
})
t.Run("expect permissions not related to team to be kept", func(t *testing.T) {
store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
user, team := createUserAndTeam(t, sql, teamSvc, 1)
user, team := createUserAndTeam(t, store.sql, sql, teamSvc, 1)
// grant permission to the team
_, err := permissionsStore.SetTeamResourcePermission(context.Background(), 1, team.ID, rs.SetResourcePermissionCommand{
@ -314,7 +314,7 @@ func TestAccessControlStore_DeleteTeamPermissions(t *testing.T) {
})
}
func createUserAndTeam(t *testing.T, userSrv user.Service, teamSvc team.Service, orgID int64) (*user.User, team.Team) {
func createUserAndTeam(t *testing.T, store db.DB, userSrv user.Service, teamSvc team.Service, orgID int64) (*user.User, team.Team) {
t.Helper()
user, err := userSrv.Create(context.Background(), &user.CreateUserCommand{
@ -326,7 +326,9 @@ func createUserAndTeam(t *testing.T, userSrv user.Service, teamSvc team.Service,
team, err := teamSvc.CreateTeam("team", "", orgID)
require.NoError(t, err)
err = teamSvc.AddTeamMember(context.Background(), user.ID, orgID, team.ID, false, dashboardaccess.PERMISSION_VIEW)
err = store.WithDbSession(context.Background(), func(sess *db.Session) error {
return teamimpl.AddOrUpdateTeamMemberHook(sess, user.ID, orgID, team.ID, false, dashboardaccess.PERMISSION_VIEW)
})
require.NoError(t, err)
return user, team
@ -348,7 +350,7 @@ type dbUser struct {
teamID int64
}
func createUsersAndTeams(t *testing.T, svcs helperServices, orgID int64, users []testUser) []dbUser {
func createUsersAndTeams(t *testing.T, store db.DB, svcs helperServices, orgID int64, users []testUser) []dbUser {
t.Helper()
res := []dbUser{}
@ -374,7 +376,9 @@ func createUsersAndTeams(t *testing.T, svcs helperServices, orgID int64, users [
team, err := svcs.teamSvc.CreateTeam(fmt.Sprintf("team%v", i+1), "", orgID)
require.NoError(t, err)
err = svcs.teamSvc.AddTeamMember(context.Background(), user.ID, orgID, team.ID, false, dashboardaccess.PERMISSION_VIEW)
err = store.WithDbSession(context.Background(), func(sess *db.Session) error {
return teamimpl.AddOrUpdateTeamMemberHook(sess, user.ID, orgID, team.ID, false, dashboardaccess.PERMISSION_VIEW)
})
require.NoError(t, err)
err = svcs.orgSvc.UpdateOrgUser(context.Background(),
@ -652,7 +656,7 @@ func TestIntegrationAccessControlStore_SearchUsersPermissions(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
acStore, permissionsStore, userSvc, teamSvc, orgSvc := setupTestEnv(t)
dbUsers := createUsersAndTeams(t, helperServices{userSvc, teamSvc, orgSvc}, 1, tt.users)
dbUsers := createUsersAndTeams(t, acStore.sql, helperServices{userSvc, teamSvc, orgSvc}, 1, tt.users)
// Switch userID and TeamID by the real stored ones
for i := range tt.permCmds {
@ -732,7 +736,7 @@ func TestAccessControlStore_GetUsersBasicRoles(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
acStore, _, userSvc, teamSvc, orgSvc := setupTestEnv(t)
dbUsers := createUsersAndTeams(t, helperServices{userSvc, teamSvc, orgSvc}, 1, tt.users)
dbUsers := createUsersAndTeams(t, acStore.sql, helperServices{userSvc, teamSvc, orgSvc}, 1, tt.users)
// Test
dbRoles, err := acStore.GetUsersBasicRoles(ctx, tt.userFilter, 1)

View File

@ -138,15 +138,15 @@ func GenerateDatasourcePermissions(b *testing.B, db db.DB, cfg *setting.Cfg, ac
return dataSources
}
func generateTeamsAndUsers(b *testing.B, db db.DB, cfg *setting.Cfg, users int) ([]int64, []int64) {
teamSvc, err := teamimpl.ProvideService(db, cfg)
func generateTeamsAndUsers(b *testing.B, store db.DB, cfg *setting.Cfg, users int) ([]int64, []int64) {
teamSvc, err := teamimpl.ProvideService(store, cfg)
require.NoError(b, err)
numberOfTeams := int(math.Ceil(float64(users) / UsersPerTeam))
globalUserId := 0
qs := quotatest.New(false, nil)
orgSvc, err := orgimpl.ProvideService(db, cfg, qs)
orgSvc, err := orgimpl.ProvideService(store, cfg, qs)
require.NoError(b, err)
usrSvc, err := userimpl.ProvideService(db, orgSvc, cfg, nil, nil, qs, supportbundlestest.NewFakeBundleService())
usrSvc, err := userimpl.ProvideService(store, orgSvc, cfg, nil, nil, qs, supportbundlestest.NewFakeBundleService())
require.NoError(b, err)
userIds := make([]int64, 0)
teamIds := make([]int64, 0)
@ -171,7 +171,9 @@ func generateTeamsAndUsers(b *testing.B, db db.DB, cfg *setting.Cfg, users int)
globalUserId++
userIds = append(userIds, userId)
err = teamSvc.AddTeamMember(context.Background(), userId, 1, teamId, false, 1)
err = store.WithDbSession(context.Background(), func(sess *db.Session) error {
return teamimpl.AddOrUpdateTeamMemberHook(sess, userId, 1, teamId, false, 1)
})
require.NoError(b, err)
}
}

View File

@ -92,9 +92,13 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.Equal(t, team1.OrgID, testOrgID)
require.EqualValues(t, team1.MemberCount, 0)
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team1.ID, false, 0)
require.NoError(t, err)
err = teamSvc.AddTeamMember(context.Background(), userIds[1], testOrgID, team1.ID, true, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
err := AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, 0)
if err != nil {
return err
}
return AddOrUpdateTeamMemberHook(sess, userIds[1], testOrgID, team1.ID, true, 0)
})
require.NoError(t, err)
q1 := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -152,7 +156,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
team1 := teamQueryResult.Teams[0]
err = teamSvc.AddTeamMember(context.Background(), userId, testOrgID, team1.ID, true, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userId, testOrgID, team1.ID, true, 0)
})
require.NoError(t, err)
memberQuery := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, External: true, SignedInUser: testUser}
@ -168,7 +174,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
t.Run("Should be able to update users in a team", func(t *testing.T) {
userId := userIds[0]
err = teamSvc.AddTeamMember(context.Background(), userId, testOrgID, team1.ID, false, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userId, testOrgID, team1.ID, false, 0)
})
require.NoError(t, err)
qBeforeUpdate := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -176,13 +184,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.NoError(t, err)
require.EqualValues(t, qBeforeUpdateResult[0].Permission, 0)
err = teamSvc.UpdateTeamMember(context.Background(), &team.UpdateTeamMemberCommand{
UserID: userId,
OrgID: testOrgID,
TeamID: team1.ID,
Permission: dashboardaccess.PERMISSION_ADMIN,
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userId, testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
})
require.NoError(t, err)
qAfterUpdate := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -195,7 +199,10 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
sqlStore = db.InitTestDB(t)
setup()
userID := userIds[0]
err = teamSvc.AddTeamMember(context.Background(), userID, testOrgID, team1.ID, false, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userID, testOrgID, team1.ID, false, 0)
})
require.NoError(t, err)
qBeforeUpdate := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -204,13 +211,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.EqualValues(t, qBeforeUpdateResult[0].Permission, 0)
invalidPermissionLevel := dashboardaccess.PERMISSION_EDIT
err = teamSvc.UpdateTeamMember(context.Background(), &team.UpdateTeamMemberCommand{
UserID: userID,
OrgID: testOrgID,
TeamID: team1.ID,
Permission: invalidPermissionLevel,
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userID, testOrgID, team1.ID, false, invalidPermissionLevel)
})
require.NoError(t, err)
qAfterUpdate := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -219,19 +222,6 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.EqualValues(t, qAfterUpdateResult[0].Permission, 0)
})
t.Run("Shouldn't be able to update a user not in the team.", func(t *testing.T) {
sqlStore = db.InitTestDB(t)
setup()
err = teamSvc.UpdateTeamMember(context.Background(), &team.UpdateTeamMemberCommand{
UserID: 1,
OrgID: testOrgID,
TeamID: team1.ID,
Permission: dashboardaccess.PERMISSION_ADMIN,
})
require.Error(t, err, team.ErrTeamMemberNotFound)
})
t.Run("Should be able to search for teams", func(t *testing.T) {
query := &team.SearchTeamsQuery{OrgID: testOrgID, Query: "group", Page: 1, SignedInUser: testUser}
queryResult, err := teamSvc.SearchTeams(context.Background(), query)
@ -251,11 +241,30 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.NoError(t, err)
// Add a team member
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team2.ID, false, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
err := AddOrUpdateTeamMemberHook(sess, userIds[2], testOrgID, team1.ID, false, 0)
if err != nil {
return err
}
err = AddOrUpdateTeamMemberHook(sess, userIds[3], testOrgID, team1.ID, false, 0)
if err != nil {
return err
}
return AddOrUpdateTeamMemberHook(sess, userIds[2], testOrgID, team2.ID, false, 0)
})
require.NoError(t, err)
defer func() {
err := teamSvc.RemoveTeamMember(context.Background(),
&team.RemoveTeamMemberCommand{OrgID: testOrgID, UserID: userIds[0], TeamID: team2.ID})
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
err := RemoveTeamMemberHook(sess, &team.RemoveTeamMemberCommand{OrgID: testOrgID, UserID: userIds[2], TeamID: team1.ID})
if err != nil {
return err
}
err = RemoveTeamMemberHook(sess, &team.RemoveTeamMemberCommand{OrgID: testOrgID, UserID: userIds[3], TeamID: team1.ID})
if err != nil {
return err
}
return RemoveTeamMemberHook(sess, &team.RemoveTeamMemberCommand{OrgID: testOrgID, UserID: userIds[2], TeamID: team2.ID})
})
require.NoError(t, err)
}()
@ -304,7 +313,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
sqlStore = db.InitTestDB(t)
setup()
groupId := team2.ID
err := teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, groupId, false, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, groupId, false, 0)
})
require.NoError(t, err)
query := &team.GetTeamsByUserQuery{
@ -323,10 +334,14 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
})
t.Run("Should be able to remove users from a group", func(t *testing.T) {
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team1.ID, false, 0)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, 0)
})
require.NoError(t, err)
err = teamSvc.RemoveTeamMember(context.Background(), &team.RemoveTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0]})
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return RemoveTeamMemberHook(sess, &team.RemoveTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0]})
})
require.NoError(t, err)
q2 := &team.GetTeamMembersQuery{OrgID: testOrgID, TeamID: team1.ID, SignedInUser: testUser}
@ -336,16 +351,22 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
})
t.Run("Should have empty teams", func(t *testing.T) {
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
})
require.NoError(t, err)
t.Run("A user should be able to remove the admin permission for the last admin", func(t *testing.T) {
err = teamSvc.UpdateTeamMember(context.Background(), &team.UpdateTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0], Permission: 0})
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, 0)
})
require.NoError(t, err)
})
t.Run("A user should be able to remove the last member", func(t *testing.T) {
err = teamSvc.RemoveTeamMember(context.Background(), &team.RemoveTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0]})
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return RemoveTeamMemberHook(sess, &team.RemoveTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0]})
})
require.NoError(t, err)
})
@ -353,12 +374,17 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
sqlStore = db.InitTestDB(t)
setup()
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
err := AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
if err != nil {
return err
}
return AddOrUpdateTeamMemberHook(sess, userIds[1], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
})
require.NoError(t, err)
err = teamSvc.AddTeamMember(context.Background(), userIds[1], testOrgID, team1.ID, false, dashboardaccess.PERMISSION_ADMIN)
require.NoError(t, err)
err = teamSvc.UpdateTeamMember(context.Background(), &team.UpdateTeamMemberCommand{OrgID: testOrgID, TeamID: team1.ID, UserID: userIds[0], Permission: 0})
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, 0)
})
require.NoError(t, err)
})
})
@ -379,12 +405,17 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
hiddenUsers := map[string]struct{}{"loginuser0": {}, "loginuser1": {}}
teamId := team1.ID
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, teamId, false, 0)
require.NoError(t, err)
err = teamSvc.AddTeamMember(context.Background(), userIds[1], testOrgID, teamId, false, 0)
require.NoError(t, err)
err = teamSvc.AddTeamMember(context.Background(), userIds[2], testOrgID, teamId, false, 0)
require.NoError(t, err)
err = sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
err := AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, teamId, false, 0)
if err != nil {
return err
}
err = AddOrUpdateTeamMemberHook(sess, userIds[1], testOrgID, teamId, false, 0)
if err != nil {
return err
}
return AddOrUpdateTeamMemberHook(sess, userIds[2], testOrgID, teamId, false, 0)
})
searchQuery := &team.SearchTeamsQuery{OrgID: testOrgID, Page: 1, Limit: 10, SignedInUser: signedInUser, HiddenUsers: hiddenUsers}
searchQueryResult, err := teamSvc.SearchTeams(context.Background(), searchQuery)
@ -417,13 +448,16 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
require.NoError(t, err)
groupId := team2.ID
// add service account to team
err = teamSvc.AddTeamMember(context.Background(), serviceAccount.ID, testOrgID, groupId, false, 0)
require.NoError(t, err)
// add user to team
err = teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, groupId, false, 0)
require.NoError(t, err)
dbErr := sqlStore.WithDbSession(context.Background(), func(sess *db.Session) error {
// add service account to team
err := AddOrUpdateTeamMemberHook(sess, serviceAccount.ID, testOrgID, groupId, false, 0)
if err != nil {
return err
}
// add user to team
return AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, groupId, false, 0)
})
require.NoError(t, dbErr)
teamMembersQuery := &team.GetTeamMembersQuery{
OrgID: testOrgID,
@ -550,14 +584,22 @@ func TestIntegrationSQLStore_GetTeamMembers_ACFilter(t *testing.T) {
userIds[i] = user.ID
}
errAddMember := teamSvc.AddTeamMember(context.Background(), userIds[0], testOrgID, team1.ID, false, 0)
require.NoError(t, errAddMember)
errAddMember = teamSvc.AddTeamMember(context.Background(), userIds[1], testOrgID, team1.ID, false, 0)
require.NoError(t, errAddMember)
errAddMember = teamSvc.AddTeamMember(context.Background(), userIds[2], testOrgID, team2.ID, false, 0)
require.NoError(t, errAddMember)
errAddMember = teamSvc.AddTeamMember(context.Background(), userIds[3], testOrgID, team2.ID, false, 0)
require.NoError(t, errAddMember)
errAddMembers := store.WithDbSession(context.Background(), func(sess *db.Session) error {
err := AddOrUpdateTeamMemberHook(sess, userIds[0], testOrgID, team1.ID, false, 0)
if err != nil {
return err
}
err = AddOrUpdateTeamMemberHook(sess, userIds[1], testOrgID, team1.ID, false, 0)
if err != nil {
return err
}
err = AddOrUpdateTeamMemberHook(sess, userIds[2], testOrgID, team2.ID, false, 0)
if err != nil {
return err
}
return AddOrUpdateTeamMemberHook(sess, userIds[3], testOrgID, team2.ID, false, 0)
})
require.NoError(t, errAddMembers)
}
store, cfg := db.InitTestDBWithCfg(t, db.InitTestDBOpt{})