Refactor redundant append operations in test setup (#5211)
* Refactor redundant append operations in test setup - Simplified code by removing unnecessary if-else conditions in the wantUserIds and wantGroupIds blocks. Fixes #5205 * chore: fmt fix
This commit is contained in:
1 parent
ae0ca0c5aa
commit
58cc322c63
1 file changed
+2
-10
@@ -141,20 +141,12 @@ func TestRepository_AddPrincipalRoles(t *testing.T) {
|
||||
if tt.args.wantUserIds {
|
||||
userIds = createUsersFn(orgs)
|
||||
u := TestUser(t, repo, staticOrg.PublicId)
|
||||
if roleId == orgRole.PublicId {
|
||||
userIds = append(userIds, u.PublicId)
|
||||
} else {
|
||||
userIds = append(userIds, u.PublicId)
|
||||
}
|
||||
userIds = append(userIds, u.PublicId)
|
||||
}
|
||||
if tt.args.wantGroupIds {
|
||||
groupIds = createGrpsFn(orgs, projects)
|
||||
g := TestGroup(t, conn, staticProj.PublicId)
|
||||
if roleId == projRole.PublicId {
|
||||
groupIds = append(groupIds, g.PublicId)
|
||||
} else {
|
||||
groupIds = append(groupIds, g.PublicId)
|
||||
}
|
||||
groupIds = append(groupIds, g.PublicId)
|
||||
}
|
||||
if len(tt.args.specificUserIds) > 0 {
|
||||
userIds = tt.args.specificUserIds
|
||||
|
||||
Reference in new issue
Block a user