Create default roles in scopes to allow authentication and listing scopes/auth methods (#502)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-29 20:38:16 -04:00
1 parent 67c7b82fbe
commit a38f40606e
31 files changed
+616 -188

No files matched your search

+7 -7
View File
@@ -143,22 +143,22 @@ func TestList(t *testing.T) {
roleClient := roles.NewClient(client)
p1, err := roleClient.List(tc.Context(), tt.scopeId)
require.NoError(err)
require.Len(p1.Items, 1)
expected = append(expected, p1.Items[0])
require.Len(p1.Items, 2)
expected = append(expected, p1.Items[0:2]...)
for i := 1; i < 11; i++ {
for i := 2; i < 12; i++ {
expected = append(expected, &roles.Role{Name: fmt.Sprint(i)})
}
rcr, err := roleClient.Create(tc.Context(), tt.scopeId, roles.WithName(expected[1].Name))
rcr, err := roleClient.Create(tc.Context(), tt.scopeId, roles.WithName(expected[2].Name))
require.NoError(err)
expected[1] = rcr.Item
expected[2] = rcr.Item
p2, err := roleClient.List(tc.Context(), tt.scopeId)
require.NoError(err)
assert.ElementsMatch(comparableSlice(expected[0:2]), comparableSlice(p2.Items))
assert.ElementsMatch(comparableSlice(expected[0:3]), comparableSlice(p2.Items))
for i := 2; i < 11; i++ {
for i := 3; i < 12; i++ {
rcr, err = roleClient.Create(tc.Context(), tt.scopeId, roles.WithName(expected[i].Name))
assert.NoError(err)
expected[i] = rcr.Item