@@ -30,223 +30,265 @@ func TestEnterpriseUserWriter_SetMembers(t *testing.T) {
3030
3131 cases := []struct {
3232 name string
33- initialUsers map [string ]* github. SCIMUserAttributes
33+ initialUsers map [string ]* SCIMUser
3434 desiredMembers []groupsync.Member
3535 maxUsersToProvision int64
3636 failCreateUserCalls bool
3737 failListUserCalls bool
38- wantUsersOnServer map [string ]* github. SCIMUserAttributes
38+ wantUsersOnServer map [string ]* SCIMUser
3939 wantErrStr string
4040 }{
4141 {
4242 name : "success_create_and_deactivate" ,
43- initialUsers : map [string ]* github. SCIMUserAttributes {
43+ initialUsers : map [string ]* SCIMUser {
4444 "scim-id-user.old" : {
45- ID : github .String ("scim-id-user.old" ),
46- UserName : "user.old" ,
47- Active : github .Bool (true ),
45+ SCIMUserAttributes : github.SCIMUserAttributes {
46+ ID : github .String ("scim-id-user.old" ),
47+ UserName : "user.old" ,
48+ Active : github .Bool (true ),
49+ },
4850 },
4951 "scim-id-user.unchanged" : {
50- ID : github .String ("scim-id-user.unchanged" ),
51- UserName : "user.unchanged" ,
52- Active : github .Bool (true ),
52+ SCIMUserAttributes : github.SCIMUserAttributes {
53+ ID : github .String ("scim-id-user.unchanged" ),
54+ UserName : "user.unchanged" ,
55+ Active : github .Bool (true ),
56+ },
5357 },
5458 },
5559 desiredMembers : []groupsync.Member {
5660 & groupsync.UserMember {
5761 Usr : & groupsync.User {
5862 ID : "user.new" ,
59- Attributes : & github.SCIMUserAttributes {
60- UserName : "user.new" ,
61- Active : github .Bool (true ),
63+ Attributes : & SCIMUser {
64+ SCIMUserAttributes : github.SCIMUserAttributes {
65+ UserName : "user.new" ,
66+ Active : github .Bool (true ),
67+ },
6268 },
6369 },
6470 },
6571 & groupsync.UserMember {
6672 Usr : & groupsync.User {
6773 ID : "user.unchanged" ,
68- Attributes : & github.SCIMUserAttributes {
69- UserName : "user.unchanged" ,
70- Active : github .Bool (true ),
74+ Attributes : & SCIMUser {
75+ SCIMUserAttributes : github.SCIMUserAttributes {
76+ UserName : "user.unchanged" ,
77+ Active : github .Bool (true ),
78+ },
7179 },
7280 },
7381 },
7482 },
75- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
83+ wantUsersOnServer : map [string ]* SCIMUser {
7684 "scim-id-user.old" : {
77- ID : github .String ("scim-id-user.old" ),
78- UserName : "user.old" ,
79- Active : github .Bool (false ),
85+ SCIMUserAttributes : github.SCIMUserAttributes {
86+ ID : github .String ("scim-id-user.old" ),
87+ UserName : "user.old" ,
88+ Active : github .Bool (false ),
89+ },
8090 },
8191 "scim-id-user.unchanged" : {
82- ID : github .String ("scim-id-user.unchanged" ),
83- UserName : "user.unchanged" ,
84- Active : github .Bool (true ),
92+ SCIMUserAttributes : github.SCIMUserAttributes {
93+ ID : github .String ("scim-id-user.unchanged" ),
94+ UserName : "user.unchanged" ,
95+ Active : github .Bool (true ),
96+ },
8597 },
8698 "scim-id-user.new" : {
87- ID : github .String ("scim-id-user.new" ),
88- UserName : "user.new" ,
89- Active : github .Bool (true ),
90- Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
99+ SCIMUserAttributes : github.SCIMUserAttributes {
100+ ID : github .String ("scim-id-user.new" ),
101+ UserName : "user.new" ,
102+ Active : github .Bool (true ),
103+ Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
104+ },
91105 },
92106 },
93107 },
94108 {
95109 name : "success_create_only" ,
96- initialUsers : map [string ]* github. SCIMUserAttributes {},
110+ initialUsers : map [string ]* SCIMUser {},
97111 desiredMembers : []groupsync.Member {
98112 & groupsync.UserMember {
99113 Usr : & groupsync.User {
100114 ID : "user.one" ,
101- Attributes : & github.SCIMUserAttributes {
102- UserName : "user.one" ,
103- Active : github .Bool (true ),
115+ Attributes : & SCIMUser {
116+ SCIMUserAttributes : github.SCIMUserAttributes {
117+ UserName : "user.one" ,
118+ Active : github .Bool (true ),
119+ },
104120 },
105121 },
106122 },
107123 },
108- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
124+ wantUsersOnServer : map [string ]* SCIMUser {
109125 "scim-id-user.one" : {
110- ID : github .String ("scim-id-user.one" ),
111- UserName : "user.one" ,
112- Active : github .Bool (true ),
113- Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
126+ SCIMUserAttributes : github.SCIMUserAttributes {
127+ ID : github .String ("scim-id-user.one" ),
128+ UserName : "user.one" ,
129+ Active : github .Bool (true ),
130+ Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
131+ },
114132 },
115133 },
116134 },
117135 {
118136 name : "success_deactivate_only" ,
119- initialUsers : map [string ]* github. SCIMUserAttributes {
137+ initialUsers : map [string ]* SCIMUser {
120138 "scim-id-user.one" : {
121- ID : github .String ("scim-id-user.one" ),
122- UserName : "user.one" ,
123- Active : github .Bool (true ),
139+ SCIMUserAttributes : github.SCIMUserAttributes {
140+ ID : github .String ("scim-id-user.one" ),
141+ UserName : "user.one" ,
142+ Active : github .Bool (true ),
143+ },
124144 },
125145 },
126146 desiredMembers : []groupsync.Member {},
127- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
147+ wantUsersOnServer : map [string ]* SCIMUser {
128148 "scim-id-user.one" : {
129- ID : github .String ("scim-id-user.one" ),
130- UserName : "user.one" ,
131- Active : github .Bool (false ),
149+ SCIMUserAttributes : github.SCIMUserAttributes {
150+ ID : github .String ("scim-id-user.one" ),
151+ UserName : "user.one" ,
152+ Active : github .Bool (false ),
153+ },
132154 },
133155 },
134156 },
135157 {
136158 name : "success_reactivate_only" ,
137- initialUsers : map [string ]* github. SCIMUserAttributes {
159+ initialUsers : map [string ]* SCIMUser {
138160 "scim-id-user.one" : {
139- ID : github .String ("scim-id-user.one" ),
140- UserName : "user.one" ,
141- Active : github .Bool (false ),
161+ SCIMUserAttributes : github.SCIMUserAttributes {
162+ ID : github .String ("scim-id-user.one" ),
163+ UserName : "user.one" ,
164+ Active : github .Bool (false ),
165+ },
142166 },
143167 },
144168 desiredMembers : []groupsync.Member {
145169 & groupsync.UserMember {
146170 Usr : & groupsync.User {
147171 ID : "user.one" ,
148- Attributes : & github.SCIMUserAttributes {
149- UserName : "user.one" ,
150- Active : github .Bool (true ),
172+ Attributes : & SCIMUser {
173+ SCIMUserAttributes : github.SCIMUserAttributes {
174+ UserName : "user.one" ,
175+ Active : github .Bool (true ),
176+ },
151177 },
152178 },
153179 },
154180 },
155- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
181+ wantUsersOnServer : map [string ]* SCIMUser {
156182 "scim-id-user.one" : {
157- ID : github .String ("scim-id-user.one" ),
158- UserName : "user.one" ,
159- Active : github .Bool (true ),
183+ SCIMUserAttributes : github.SCIMUserAttributes {
184+ ID : github .String ("scim-id-user.one" ),
185+ UserName : "user.one" ,
186+ Active : github .Bool (true ),
187+ },
160188 },
161189 },
162190 },
163191 {
164192 name : "no_op" ,
165- initialUsers : map [string ]* github. SCIMUserAttributes {
193+ initialUsers : map [string ]* SCIMUser {
166194 "scim-id-user.one" : {
167- ID : github .String ("scim-id-user.one" ),
168- UserName : "user.one" ,
169- Active : github .Bool (false ),
195+ SCIMUserAttributes : github.SCIMUserAttributes {
196+ ID : github .String ("scim-id-user.one" ),
197+ UserName : "user.one" ,
198+ Active : github .Bool (false ),
199+ },
170200 },
171201 },
172202 desiredMembers : []groupsync.Member {},
173- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
203+ wantUsersOnServer : map [string ]* SCIMUser {
174204 "scim-id-user.one" : {
175- ID : github .String ("scim-id-user.one" ),
176- UserName : "user.one" ,
177- Active : github .Bool (false ),
205+ SCIMUserAttributes : github.SCIMUserAttributes {
206+ ID : github .String ("scim-id-user.one" ),
207+ UserName : "user.one" ,
208+ Active : github .Bool (false ),
209+ },
178210 },
179211 },
180212 },
181213 {
182214 name : "error_list_fails" ,
183- initialUsers : map [string ]* github. SCIMUserAttributes {
215+ initialUsers : map [string ]* SCIMUser {
184216 "scim-id-user.one" : {
185- ID : github .String ("scim-id-user.one" ),
186- UserName : "user.one" ,
217+ SCIMUserAttributes : github.SCIMUserAttributes {
218+ ID : github .String ("scim-id-user.one" ),
219+ UserName : "user.one" ,
220+ },
187221 },
188222 },
189223 failListUserCalls : true ,
190224 wantErrStr : "failed to list users: failed to list scim users starting at index 1: request failed with status 500" ,
191- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
225+ wantUsersOnServer : map [string ]* SCIMUser {
192226 "scim-id-user.one" : {
193- ID : github .String ("scim-id-user.one" ),
194- UserName : "user.one" ,
227+ SCIMUserAttributes : github.SCIMUserAttributes {
228+ ID : github .String ("scim-id-user.one" ),
229+ UserName : "user.one" ,
230+ },
195231 },
196232 },
197233 },
198234 {
199235 name : "error_create_fails" ,
200- initialUsers : map [string ]* github. SCIMUserAttributes {
236+ initialUsers : map [string ]* SCIMUser {
201237 "scim-id-user.old" : {
202- ID : github .String ("scim-id-user.old" ),
203- UserName : "user.old" ,
204- Active : github .Bool (true ),
238+ SCIMUserAttributes : github.SCIMUserAttributes {
239+ ID : github .String ("scim-id-user.old" ),
240+ UserName : "user.old" ,
241+ Active : github .Bool (true ),
242+ },
205243 },
206244 },
207245 desiredMembers : []groupsync.Member {
208246 & groupsync.UserMember {
209247 Usr : & groupsync.User {
210248 ID : "user.new" ,
211- Attributes : & github.SCIMUserAttributes {UserName : "user.new" },
249+ Attributes : & SCIMUser { SCIMUserAttributes : github.SCIMUserAttributes {UserName : "user.new" } },
212250 },
213251 },
214252 },
215253 failCreateUserCalls : true ,
216254 wantErrStr : "failed to create \" user.new\" : request failed with status 500" ,
217- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
255+ wantUsersOnServer : map [string ]* SCIMUser {
218256 "scim-id-user.old" : {
219- ID : github .String ("scim-id-user.old" ),
220- UserName : "user.old" ,
221- Active : github .Bool (false ),
257+ SCIMUserAttributes : github.SCIMUserAttributes {
258+ ID : github .String ("scim-id-user.old" ),
259+ UserName : "user.old" ,
260+ Active : github .Bool (false ),
261+ },
222262 },
223263 },
224264 },
225265 {
226266 name : "error_exceeds_max_users" ,
227267 maxUsersToProvision : 1 ,
228- initialUsers : map [string ]* github. SCIMUserAttributes {},
268+ initialUsers : map [string ]* SCIMUser {},
229269 desiredMembers : []groupsync.Member {
230270 & groupsync.UserMember {
231271 Usr : & groupsync.User {
232272 ID : "user.one" ,
233- Attributes : & github.SCIMUserAttributes {UserName : "user.one" },
273+ Attributes : & SCIMUser { SCIMUserAttributes : github.SCIMUserAttributes {UserName : "user.one" } },
234274 },
235275 },
236276 & groupsync.UserMember {
237277 Usr : & groupsync.User {
238278 ID : "user.two" ,
239- Attributes : & github.SCIMUserAttributes {UserName : "user.two" },
279+ Attributes : & SCIMUser { SCIMUserAttributes : github.SCIMUserAttributes {UserName : "user.two" } },
240280 },
241281 },
242282 },
243283 wantErrStr : "exceeded max users to provision: 1" ,
244- wantUsersOnServer : map [string ]* github. SCIMUserAttributes {
284+ wantUsersOnServer : map [string ]* SCIMUser {
245285 "scim-id-user.one" : {
246- ID : github .String ("scim-id-user.one" ),
247- UserName : "user.one" ,
248- Active : github .Bool (true ),
249- Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
286+ SCIMUserAttributes : github.SCIMUserAttributes {
287+ ID : github .String ("scim-id-user.one" ),
288+ UserName : "user.one" ,
289+ Active : github .Bool (true ),
290+ Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:User" },
291+ },
250292 },
251293 },
252294 },
0 commit comments