(t *testing.T, userIdent string, includeDefault bool, expected []uuid.UUID)
| 1112 | } |
| 1113 | |
| 1114 | func (r *oidcTestRunner) AssertOrganizations(t *testing.T, userIdent string, includeDefault bool, expected []uuid.UUID) { |
| 1115 | t.Helper() |
| 1116 | |
| 1117 | ctx := testutil.Context(t, testutil.WaitMedium) |
| 1118 | userOrgs, err := r.AdminClient.OrganizationsByUser(ctx, userIdent) |
| 1119 | require.NoError(t, err) |
| 1120 | |
| 1121 | cpy := make([]uuid.UUID, 0, len(expected)) |
| 1122 | cpy = append(cpy, expected...) |
| 1123 | hasDefault := false |
| 1124 | userOrgIDs := slice.List(userOrgs, func(o codersdk.Organization) uuid.UUID { |
| 1125 | if o.IsDefault { |
| 1126 | hasDefault = true |
| 1127 | cpy = append(cpy, o.ID) |
| 1128 | } |
| 1129 | return o.ID |
| 1130 | }) |
| 1131 | |
| 1132 | require.Equal(t, includeDefault, hasDefault, "expected default org") |
| 1133 | require.ElementsMatch(t, cpy, userOrgIDs, "expected orgs") |
| 1134 | } |
| 1135 | |
| 1136 | func (r *oidcTestRunner) AssertRoles(t *testing.T, userIdent string, roles []string) { |
| 1137 | t.Helper() |
no test coverage detected