@@ -103,13 +103,13 @@ describe(commands.GROUP_USER_LIST, () => {
103
103
104
104
it ( 'correctly lists all users in a Azure AD group by id' , async ( ) => {
105
105
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
106
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
106
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
107
107
return {
108
108
"value" : [ { "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ]
109
109
} ;
110
110
}
111
111
112
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
112
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
113
113
return {
114
114
"value" : [
115
115
{ "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ,
@@ -147,13 +147,13 @@ describe(commands.GROUP_USER_LIST, () => {
147
147
sinon . stub ( aadGroup , 'getGroupIdByDisplayName' ) . resolves ( groupId ) ;
148
148
149
149
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
150
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
150
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
151
151
return {
152
152
"value" : [ { "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ]
153
153
} ;
154
154
}
155
155
156
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
156
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
157
157
return {
158
158
"value" : [
159
159
{ "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ,
@@ -189,7 +189,7 @@ describe(commands.GROUP_USER_LIST, () => {
189
189
190
190
it ( 'correctly lists all owners in a Azure AD group' , async ( ) => {
191
191
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
192
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
192
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
193
193
return {
194
194
"value" : [ { "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ]
195
195
} ;
@@ -212,7 +212,7 @@ describe(commands.GROUP_USER_LIST, () => {
212
212
213
213
it ( 'correctly lists all members in a Azure AD group' , async ( ) => {
214
214
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
215
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
215
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
216
216
return {
217
217
"value" : [
218
218
{ "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "anne.matthews@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" } ,
@@ -248,18 +248,18 @@ describe(commands.GROUP_USER_LIST, () => {
248
248
249
249
it ( 'correctly lists properties for all users in a Azure AD group' , async ( ) => {
250
250
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
251
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=displayName,mail` ) {
251
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=displayName,mail,id ` ) {
252
252
return {
253
253
"value" : [
254
- { "displayName" : "Karl Matteson" , "mail" : "karl.matteson@contoso.onmicrosoft.com" }
254
+ { "id" : "00000000-0000-0000-0000-000000000000" , " displayName" : "Karl Matteson" , "mail" : "karl.matteson@contoso.onmicrosoft.com" }
255
255
]
256
256
} ;
257
257
}
258
258
259
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/members ?$select=displayName,mail` ) {
259
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members ?$select=displayName,mail,id ` ) {
260
260
return {
261
261
"value" : [
262
- { "displayName" : "Anne Matthews" , "mail" : "anne.matthews@contoso.onmicrosoft.com" }
262
+ { "id" : "00000000-0000-0000-0000-000000000001" , " displayName" : "Anne Matthews" , "mail" : "anne.matthews@contoso.onmicrosoft.com" }
263
263
]
264
264
} ;
265
265
}
@@ -270,20 +270,20 @@ describe(commands.GROUP_USER_LIST, () => {
270
270
await command . action ( logger , { options : { groupId : groupId , properties : "displayName,mail" } } ) ;
271
271
272
272
assert ( loggerLogSpy . calledOnceWithExactly ( [
273
- { "displayName" : "Karl Matteson" , "mail" : "karl.matteson@contoso.onmicrosoft.com" } ,
274
- { "displayName" : "Anne Matthews" , "mail" : "anne.matthews@contoso.onmicrosoft.com" }
273
+ { "id" : "00000000-0000-0000-0000-000000000000" , " displayName" : "Karl Matteson" , "mail" : "karl.matteson@contoso.onmicrosoft.com" , "roles" : [ "Owner" ] } ,
274
+ { "id" : "00000000-0000-0000-0000-000000000001" , " displayName" : "Anne Matthews" , "mail" : "anne.matthews@contoso.onmicrosoft.com" , "roles" : [ "Member" ] }
275
275
] ) ) ;
276
276
} ) ;
277
277
278
278
it ( 'correctly lists all guest users in a Azure AD group' , async ( ) => {
279
279
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
280
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true` ) {
280
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true` ) {
281
281
return {
282
282
"value" : [ ]
283
283
} ;
284
284
}
285
285
286
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/members ?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true` ) {
286
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members ?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true` ) {
287
287
return {
288
288
"value" : [
289
289
{ "id" : "00000000-0000-0000-0000-000000000000" , "displayName" : "Anne Matthews" , "userPrincipalName" : "annematthews_gmail.com#EXT#@contoso.onmicrosoft.com" , "givenName" : "Anne" , "surname" : "Matthews" }
@@ -322,7 +322,7 @@ describe(commands.GROUP_USER_LIST, () => {
322
322
} ;
323
323
324
324
sinon . stub ( request , 'get' ) . callsFake ( async ( opts ) => {
325
- if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
325
+ if ( opts . url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners ?$select=id,displayName,userPrincipalName,givenName,surname` ) {
326
326
throw error ;
327
327
}
328
328
0 commit comments