@@ -121,6 +121,100 @@ func TestSCIMService_ListSCIMProvisionedIdentities(t *testing.T) {
121
121
})
122
122
}
123
123
124
+ func TestSCIMService_ListSCIMProvisionedGroups (t * testing.T ) {
125
+ t .Parallel ()
126
+ client , mux , _ := setup (t )
127
+
128
+ mux .HandleFunc ("/scim/v2/enterprises/o/Groups" , func (w http.ResponseWriter , r * http.Request ) {
129
+ testMethod (t , r , "GET" )
130
+ w .WriteHeader (http .StatusOK )
131
+ _ , _ = w .Write ([]byte (`{
132
+ "schemas": [
133
+ "urn:ietf:params:scim:api:messages:2.0:ListResponse"
134
+ ],
135
+ "totalResults": 1,
136
+ "itemsPerPage": 1,
137
+ "startIndex": 1,
138
+ "Resources": [
139
+ {
140
+ "schemas": [
141
+ "urn:ietf:params:scim:schemas:core:2.0:Group"
142
+ ],
143
+ "id": "123e4567-e89b-12d3-a456-426614174000",
144
+ "externalId": "00u1dhhb1fkIGP7RL1d8",
145
+ "displayName": "Mona Octocat",
146
+ "meta": {
147
+ "resourceType": "Group",
148
+ "created": "2018-02-13T15:05:24.000-00:00",
149
+ "lastModified": "2018-02-13T15:05:24.000-00:00",
150
+ "location": "https://api.github.com/scim/v2/enterprises/octo/Groups/123e4567-e89b-12d3-a456-426614174000"
151
+ },
152
+ "members": [
153
+ {
154
+ "value": "5fc0c238-1112-11e8-8e45-920c87bdbd75",
155
+ "$ref": "https://api.github.com/scim/v2/enterprises/octo/Users/5fc0c238-1112-11e8-8e45-920c87bdbd75",
156
+ "display": "Mona Octocat"
157
+ }
158
+ ]
159
+ }
160
+ ]
161
+ }` ))
162
+ })
163
+
164
+ ctx := context .Background ()
165
+ opts := & ListSCIMProvisionedIdentitiesOptions {}
166
+ groups , _ , err := client .SCIM .ListSCIMProvisionedGroupsForEnterprise (ctx , "o" , opts )
167
+ if err != nil {
168
+ t .Errorf ("SCIM.ListSCIMProvisionedIdentities returned error: %v" , err )
169
+ }
170
+
171
+ date := Timestamp {time .Date (2018 , time .February , 13 , 15 , 5 , 24 , 0 , time .UTC )}
172
+ want := SCIMProvisionedGroups {
173
+ Schemas : []string {"urn:ietf:params:scim:api:messages:2.0:ListResponse" },
174
+ TotalResults : Ptr (1 ),
175
+ ItemsPerPage : Ptr (1 ),
176
+ StartIndex : Ptr (1 ),
177
+ Resources : []* SCIMGroupAttributes {
178
+ {
179
+ ID : Ptr ("123e4567-e89b-12d3-a456-426614174000" ),
180
+ Meta : & SCIMMeta {
181
+ ResourceType : Ptr ("Group" ),
182
+ Created : & date ,
183
+ LastModified : & date ,
184
+ Location : Ptr ("https://api.github.com/scim/v2/enterprises/octo/Groups/123e4567-e89b-12d3-a456-426614174000" ),
185
+ },
186
+
187
+ DisplayName : Ptr ("Mona Octocat" ),
188
+ Schemas : []string {"urn:ietf:params:scim:schemas:core:2.0:Group" },
189
+ ExternalID : Ptr ("00u1dhhb1fkIGP7RL1d8" ),
190
+ Members : []* SCIMDisplayReference {
191
+ {
192
+ Value : "5fc0c238-1112-11e8-8e45-920c87bdbd75" ,
193
+ Ref : "https://api.github.com/scim/v2/enterprises/octo/Users/5fc0c238-1112-11e8-8e45-920c87bdbd75" ,
194
+ Display : Ptr ("Mona Octocat" ),
195
+ },
196
+ },
197
+ },
198
+ },
199
+ }
200
+
201
+ if ! cmp .Equal (groups , & want ) {
202
+ diff := cmp .Diff (groups , want )
203
+ t .Errorf ("SCIM.ListSCIMProvisionedGroupsForEnterprise returned %+v, want %+v: diff %+v" , groups , want , diff )
204
+ }
205
+
206
+ const methodName = "ListSCIMProvisionedGroupsForEnterprise"
207
+ testBadOptions (t , methodName , func () (err error ) {
208
+ _ , _ , err = client .SCIM .ListSCIMProvisionedGroupsForEnterprise (ctx , "\n " , opts )
209
+ return err
210
+ })
211
+
212
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
213
+ _ , r , err := client .SCIM .ListSCIMProvisionedGroupsForEnterprise (ctx , "o" , opts )
214
+ return r , err
215
+ })
216
+ }
217
+
124
218
func TestSCIMService_ProvisionAndInviteSCIMUser (t * testing.T ) {
125
219
t .Parallel ()
126
220
client , mux , _ := setup (t )
0 commit comments