Don't create a default role when the scope being created is a project (#658)

* Don't create a default role when the scope being created is a project

* Fix up some more tests
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-10-13 13:56:21 -04:00
1 parent 52a43b65b4
commit 13631064fc
4 files changed
+23 -11

No files matched your search

@@ -202,7 +202,7 @@ func TestList(t *testing.T) {
name: "Cant List Project Scopes",
scopeId: p1.GetPublicId(),
req: &pbs.ListScopesRequest{ScopeId: p1.GetPublicId()},
err: handlers.ApiErrorWithCode(codes.InvalidArgument),
err: handlers.ApiErrorWithCode(codes.InvalidArgument),
},
}
for _, tc := range cases {
@@ -615,7 +615,12 @@ func TestCreate(t *testing.T) {
require.NoError(err)
roles, err := repo.ListRoles(ctx, got.GetItem().GetId())
require.NoError(err)
require.Len(roles, 2)
switch tc.scopeId {
case defaultOrg.PublicId:
require.Len(roles, 1)
case "global":
require.Len(roles, 2)
}
for _, role := range roles {
switch role.GetName() {
case "Administration":