auth0 5.0.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -5
- data/CHANGELOG.md +46 -0
- data/README.md +81 -1
- data/auth0.gemspec +6 -6
- data/lib/auth0/api/authentication_endpoints.rb +16 -6
- data/lib/auth0/api/v2.rb +8 -4
- data/lib/auth0/api/v2/branding.rb +66 -0
- data/lib/auth0/api/v2/connections.rb +8 -2
- data/lib/auth0/api/v2/device_credentials.rb +3 -3
- data/lib/auth0/api/v2/jobs.rb +3 -1
- data/lib/auth0/api/v2/organizations.rb +335 -0
- data/lib/auth0/api/v2/tickets.rb +14 -2
- data/lib/auth0/api/v2/users.rb +12 -0
- data/lib/auth0/exception.rb +3 -1
- data/lib/auth0/mixins/httpproxy.rb +4 -1
- data/lib/auth0/mixins/initializer.rb +3 -1
- data/lib/auth0/mixins/validation.rb +14 -0
- data/lib/auth0/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +38 -26
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +38 -24
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +38 -26
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +45 -24
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +75 -39
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +39 -28
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +37 -25
- data/spec/lib/auth0/api/v2/branding_spec.rb +70 -0
- data/spec/lib/auth0/api/v2/connections_spec.rb +5 -1
- data/spec/lib/auth0/api/v2/device_credentials_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/jobs_spec.rb +11 -0
- data/spec/lib/auth0/api/v2/organizations_spec.rb +593 -0
- data/spec/lib/auth0/api/v2/tickets_spec.rb +55 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +19 -0
- data/spec/lib/auth0/client_spec.rb +79 -9
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +8 -8
- data/spec/lib/auth0/mixins/validation_spec.rb +32 -0
- metadata +21 -15
@@ -22,9 +22,9 @@ describe Auth0::Api::V2::DeviceCredentials do
|
|
22
22
|
)
|
23
23
|
expect { @instance.device_credentials(client_id) }.not_to raise_error
|
24
24
|
end
|
25
|
-
it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\'' do
|
25
|
+
it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\'' do
|
26
26
|
expect { @instance.device_credentials(client_id, type: 'invalid_type') }.to raise_error(
|
27
|
-
'Type must be one of \'public_key\', \'refresh_token\''
|
27
|
+
'Type must be one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\''
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
@@ -119,6 +119,17 @@ describe Auth0::Api::V2::Jobs do
|
|
119
119
|
)
|
120
120
|
end
|
121
121
|
|
122
|
+
it 'expect client to accept organization_id' do
|
123
|
+
expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email',
|
124
|
+
user_id: 'user_id',
|
125
|
+
organization_id: 'org_id'
|
126
|
+
)
|
127
|
+
|
128
|
+
expect {
|
129
|
+
@instance.send_verification_email('user_id', organization_id: 'org_id')
|
130
|
+
}.not_to raise_error
|
131
|
+
end
|
132
|
+
|
122
133
|
it 'should raise an error if the user_id is empty' do
|
123
134
|
expect do
|
124
135
|
@instance.send_verification_email('')
|
@@ -0,0 +1,593 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe Auth0::Api::V2::Organizations do
|
3
|
+
before :all do
|
4
|
+
dummy_instance = DummyClass.new
|
5
|
+
dummy_instance.extend(Auth0::Api::V2::Organizations)
|
6
|
+
@instance = dummy_instance
|
7
|
+
end
|
8
|
+
|
9
|
+
context '.organizations' do
|
10
|
+
it 'is expected to respond to a organizations method' do
|
11
|
+
expect(@instance).to respond_to(:organizations)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'is expected to respond to a get_organizations method' do
|
15
|
+
expect(@instance).to respond_to(:get_organizations)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'is expected to get /api/v2/organizations' do
|
19
|
+
expect(@instance).to receive(:get).with(
|
20
|
+
'/api/v2/organizations',
|
21
|
+
per_page: nil,
|
22
|
+
page: nil,
|
23
|
+
include_totals: nil
|
24
|
+
)
|
25
|
+
expect { @instance.organizations }.not_to raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'is expected to get /api/v2/organizations with custom parameters' do
|
29
|
+
expect(@instance).to receive(:get).with(
|
30
|
+
'/api/v2/organizations',
|
31
|
+
per_page: 10,
|
32
|
+
page: 1,
|
33
|
+
include_totals: true
|
34
|
+
)
|
35
|
+
expect do
|
36
|
+
@instance.organizations(
|
37
|
+
per_page: 10,
|
38
|
+
page: 1,
|
39
|
+
include_totals: true
|
40
|
+
)
|
41
|
+
end.not_to raise_error
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context '.organization' do
|
46
|
+
it 'is expected to respond to a user method' do
|
47
|
+
expect(@instance).to respond_to(:organization)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'is expected to call get request to /api/v2/users/org_id' do
|
51
|
+
expect(@instance).to receive(:get).with(
|
52
|
+
'/api/v2/organizations/org_id'
|
53
|
+
)
|
54
|
+
expect { @instance.organization('org_id') }.not_to raise_error
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is expected to raise an exception when the organization ID is empty' do
|
58
|
+
expect { @instance.organization(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context '.create_organization' do
|
63
|
+
it 'is expected to respond to a create_organization method' do
|
64
|
+
expect(@instance).to respond_to(:create_organization)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'is expected to post to /api/v2/organizations' do
|
68
|
+
expect(@instance).to receive(:post).with(
|
69
|
+
'/api/v2/organizations',
|
70
|
+
name: 'test_org'
|
71
|
+
)
|
72
|
+
expect do
|
73
|
+
@instance.create_organization(
|
74
|
+
name: 'test_org'
|
75
|
+
)
|
76
|
+
end.not_to raise_error
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context '.delete_organization' do
|
81
|
+
it 'is expected to respond to a delete_organization method' do
|
82
|
+
expect(@instance).to respond_to :delete_organization
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'is expected to call delete to /api/v2/organizations/org_id' do
|
86
|
+
expect(@instance).to receive(:delete).with('/api/v2/organizations/org_id')
|
87
|
+
expect { @instance.delete_organization('org_id') }.not_to raise_error
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'is expected not to delete /api/v2/organizations if organization_id is blank' do
|
91
|
+
expect(@instance).not_to receive(:delete)
|
92
|
+
expect { @instance.delete_organization(nil) }.to raise_exception(
|
93
|
+
Auth0::MissingOrganizationId
|
94
|
+
)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context '.organization_by_name' do
|
99
|
+
it 'is expected to respond to a user method' do
|
100
|
+
expect(@instance).to respond_to(:organization_by_name)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'is expected to call get request to /api/v2/users/org_id' do
|
104
|
+
expect(@instance).to receive(:get).with(
|
105
|
+
'/api/v2/organizations/name/org_id'
|
106
|
+
)
|
107
|
+
expect { @instance.organization_by_name('org_id') }.not_to raise_error
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'is expected to raise an exception when the organization ID is empty' do
|
111
|
+
expect { @instance.organization_by_name(nil) }.to raise_exception(Auth0::InvalidParameter)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
context '.patch_organization' do
|
117
|
+
it 'is expected to respond to a patch_organization method' do
|
118
|
+
expect(@instance).to respond_to(:patch_organization)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'is expected to respond to a update_organization method' do
|
122
|
+
expect(@instance).to respond_to(:update_organization)
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'is expected to patch /api/v2/organizations/org_id' do
|
126
|
+
expect(@instance).to receive(:patch).with(
|
127
|
+
'/api/v2/organizations/org_id',
|
128
|
+
name: 'name'
|
129
|
+
)
|
130
|
+
@instance.patch_organization(
|
131
|
+
'org_id',
|
132
|
+
name: 'name'
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
137
|
+
expect { @instance.patch_organization(nil, 'BODY') }.to raise_exception(Auth0::MissingOrganizationId)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'is expected to raise an error when the body is empty' do
|
141
|
+
expect { @instance.patch_organization('org_id', nil) }.to raise_error 'Must supply a valid body'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context '.get_organizations_enabled_connections' do
|
146
|
+
it 'is expected to respond to a get_organizations_enabled_connections method' do
|
147
|
+
expect(@instance).to respond_to(:get_organizations_enabled_connections)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
151
|
+
expect { @instance.get_organizations_enabled_connections(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'is expected to get enabled_connections for an org' do
|
155
|
+
expect(@instance).to receive(:get).with(
|
156
|
+
'/api/v2/organizations/org_id/enabled_connections'
|
157
|
+
)
|
158
|
+
expect { @instance.get_organizations_enabled_connections('org_id') }.not_to raise_error
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'is expected to get enabled_connections for an org' do
|
162
|
+
expect(@instance).to receive(:get).with(
|
163
|
+
'/api/v2/organizations/org_id/enabled_connections'
|
164
|
+
)
|
165
|
+
expect do
|
166
|
+
@instance.get_organizations_enabled_connections('org_id')
|
167
|
+
end.not_to raise_error
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
context '.get_organizations_enabled_connection' do
|
172
|
+
it 'is expected to respond to a get_organizations_enabled_connection method' do
|
173
|
+
expect(@instance).to respond_to(:get_organizations_enabled_connection)
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
177
|
+
expect { @instance.get_organizations_enabled_connection(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
181
|
+
expect { @instance.get_organizations_enabled_connection('org_id', nil) }.to raise_exception(Auth0::InvalidParameter)
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'is expected to get enabled connection for an org' do
|
185
|
+
expect(@instance).to receive(:get).with(
|
186
|
+
'/api/v2/organizations/org_id/enabled_connections/connection_id'
|
187
|
+
)
|
188
|
+
expect { @instance.get_organizations_enabled_connection('org_id', 'connection_id') }.not_to raise_error
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'is expected to get enabled connection for an org' do
|
192
|
+
expect(@instance).to receive(:get).with(
|
193
|
+
'/api/v2/organizations/org_id/enabled_connections/connection_id'
|
194
|
+
)
|
195
|
+
expect do
|
196
|
+
@instance.get_organizations_enabled_connection('org_id', 'connection_id')
|
197
|
+
end.not_to raise_error
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context '.patch_organizations_enabled_connection' do
|
202
|
+
it 'is expected to respond to a patch_organizations_enabled_connection method' do
|
203
|
+
expect(@instance).to respond_to(:patch_organizations_enabled_connection)
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'is expected to respond to a update_organizations_enabled_connection method' do
|
207
|
+
expect(@instance).to respond_to(:update_organizations_enabled_connection)
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'is expected to patch /api/v2/organizations/org_id/enabled_connections/connection_id' do
|
211
|
+
expect(@instance).to receive(:patch).with(
|
212
|
+
'/api/v2/organizations/org_id/enabled_connections/connection_id',
|
213
|
+
{
|
214
|
+
assign_membership_on_login: false
|
215
|
+
}
|
216
|
+
)
|
217
|
+
@instance.patch_organizations_enabled_connection(
|
218
|
+
'org_id',
|
219
|
+
'connection_id',
|
220
|
+
assign_membership_on_login: false
|
221
|
+
)
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
225
|
+
expect { @instance.patch_organizations_enabled_connection(nil, 'BODY') }.to raise_exception(Auth0::MissingOrganizationId)
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'is expected to raise an error when the connection_id is empty' do
|
229
|
+
expect { @instance.patch_organizations_enabled_connection('org_id', nil) }.to raise_error 'Must supply a valid connection id'
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'is expected to raise an error when assign_membership_on_login is nil' do
|
233
|
+
expect { @instance.patch_organizations_enabled_connection('org_id', 'connection_id') }.to raise_error 'Must supply a valid assign_membership_on_login value'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
context '.create_organizations_enabled_connection' do
|
238
|
+
it 'is expected to respond to a create_organizations_enabled_connection method' do
|
239
|
+
expect(@instance).to respond_to(:create_organizations_enabled_connection)
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'is expected to respond to a add_organizations_enabled_connection method' do
|
243
|
+
expect(@instance).to respond_to(:add_organizations_enabled_connection)
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'is expected to post /api/v2/organizations/org_id/enabled_connections' do
|
247
|
+
expect(@instance).to receive(:post).with(
|
248
|
+
'/api/v2/organizations/org_id/enabled_connections',
|
249
|
+
{
|
250
|
+
connection_id: 'connection_id',
|
251
|
+
assign_membership_on_login: true
|
252
|
+
}
|
253
|
+
)
|
254
|
+
@instance.create_organizations_enabled_connection('org_id', 'connection_id', assign_membership_on_login: true)
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
258
|
+
expect { @instance.create_organizations_enabled_connection(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'is expected to raise an exception when the connection id is empty' do
|
262
|
+
expect { @instance.create_organizations_enabled_connection('123', nil) }.to raise_error 'Must supply a valid connection id'
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
context '.delete_organizations_enabled_connection' do
|
267
|
+
it 'is expected to respond to a delete_organizations_enabled_connection method' do
|
268
|
+
expect(@instance).to respond_to(:delete_organizations_enabled_connection)
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'is expected to respond to a remove_organizations_enabled_connection method' do
|
272
|
+
expect(@instance).to respond_to(:remove_organizations_enabled_connection)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'is expected to delete /api/v2/organizations/org_id/enabled_connections/connection_id' do
|
276
|
+
expect(@instance).to receive(:delete).with(
|
277
|
+
'/api/v2/organizations/org_id/enabled_connections/connection_id'
|
278
|
+
)
|
279
|
+
@instance.delete_organizations_enabled_connection('org_id', 'connection_id')
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
283
|
+
expect { @instance.delete_organizations_enabled_connection(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'is expected to raise an exception when the connection id is empty' do
|
287
|
+
expect { @instance.delete_organizations_enabled_connection('org_id', nil) }.to raise_error 'Must supply a valid connection id'
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
context '.get_organizations_invites' do
|
292
|
+
it 'is expected to respond to a get_organizations_invites method' do
|
293
|
+
expect(@instance).to respond_to(:get_organizations_invites)
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
297
|
+
expect { @instance.get_organizations_invites(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'is expected to get invitations for an org' do
|
301
|
+
expect(@instance).to receive(:get).with(
|
302
|
+
'/api/v2/organizations/org_id/invitations'
|
303
|
+
)
|
304
|
+
expect { @instance.get_organizations_invites('org_id') }.not_to raise_error
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'is expected to get invitations for an org' do
|
308
|
+
expect(@instance).to receive(:get).with(
|
309
|
+
'/api/v2/organizations/org_id/invitations'
|
310
|
+
)
|
311
|
+
expect do
|
312
|
+
@instance.get_organizations_invites('org_id')
|
313
|
+
end.not_to raise_error
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
context '.get_organizations_invite' do
|
318
|
+
it 'is expected to respond to a get_organizations_invite method' do
|
319
|
+
expect(@instance).to respond_to(:get_organizations_invite)
|
320
|
+
end
|
321
|
+
|
322
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
323
|
+
expect { @instance.get_organizations_invite(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
327
|
+
expect { @instance.get_organizations_invite('org_id', nil) }.to raise_exception(Auth0::InvalidParameter)
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'is expected to get enabled connection for an org' do
|
331
|
+
expect(@instance).to receive(:get).with(
|
332
|
+
'/api/v2/organizations/org_id/invitations/invite_id'
|
333
|
+
)
|
334
|
+
expect { @instance.get_organizations_invite('org_id', 'invite_id') }.not_to raise_error
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'is expected to get enabled connection for an org' do
|
338
|
+
expect(@instance).to receive(:get).with(
|
339
|
+
'/api/v2/organizations/org_id/invitations/invite_id'
|
340
|
+
)
|
341
|
+
expect do
|
342
|
+
@instance.get_organizations_invite('org_id', 'invite_id')
|
343
|
+
end.not_to raise_error
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
context '.patch_organizations_enabled_connection' do
|
348
|
+
it 'is expected to respond to a patch_organizations_enabled_connection method' do
|
349
|
+
expect(@instance).to respond_to(:patch_organizations_enabled_connection)
|
350
|
+
end
|
351
|
+
|
352
|
+
it 'is expected to respond to a update_organizations_enabled_connection method' do
|
353
|
+
expect(@instance).to respond_to(:update_organizations_enabled_connection)
|
354
|
+
end
|
355
|
+
|
356
|
+
it 'is expected to patch /api/v2/organizations/org_id/enabled_connections/connection_id' do
|
357
|
+
expect(@instance).to receive(:patch).with(
|
358
|
+
'/api/v2/organizations/org_id/enabled_connections/connection_id',
|
359
|
+
{
|
360
|
+
assign_membership_on_login: false
|
361
|
+
}
|
362
|
+
)
|
363
|
+
@instance.patch_organizations_enabled_connection(
|
364
|
+
'org_id',
|
365
|
+
'connection_id',
|
366
|
+
assign_membership_on_login: false
|
367
|
+
)
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
371
|
+
expect { @instance.patch_organizations_enabled_connection(nil, 'BODY') }.to raise_exception(Auth0::MissingOrganizationId)
|
372
|
+
end
|
373
|
+
|
374
|
+
it 'is expected to raise an error when the connection_id is empty' do
|
375
|
+
expect { @instance.patch_organizations_enabled_connection('org_id', nil) }.to raise_error 'Must supply a valid connection id'
|
376
|
+
end
|
377
|
+
|
378
|
+
it 'is expected to raise an error when assign_membership_on_login is nil' do
|
379
|
+
expect { @instance.patch_organizations_enabled_connection('org_id', 'connection_id') }.to raise_error 'Must supply a valid assign_membership_on_login value'
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
context '.create_organizations_invite' do
|
384
|
+
it 'is expected to respond to a create_organizations_invite method' do
|
385
|
+
expect(@instance).to respond_to(:create_organizations_invite)
|
386
|
+
end
|
387
|
+
|
388
|
+
it 'is expected to respond to a add_organizations_invite method' do
|
389
|
+
expect(@instance).to respond_to(:add_organizations_invite)
|
390
|
+
end
|
391
|
+
|
392
|
+
it 'is expected to post /api/v2/organizations/org_id/invitations' do
|
393
|
+
expect(@instance).to receive(:post).with(
|
394
|
+
'/api/v2/organizations/org_id/invitations',
|
395
|
+
{
|
396
|
+
ttl_sec: 60000
|
397
|
+
}
|
398
|
+
)
|
399
|
+
@instance.create_organizations_invite('org_id', ttl_sec: 60000)
|
400
|
+
end
|
401
|
+
|
402
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
403
|
+
expect { @instance.create_organizations_invite(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
context '.delete_organizations_invite' do
|
408
|
+
it 'is expected to respond to a delete_organizations_invite method' do
|
409
|
+
expect(@instance).to respond_to(:delete_organizations_invite)
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'is expected to respond to a remove_organizations_invite method' do
|
413
|
+
expect(@instance).to respond_to(:remove_organizations_invite)
|
414
|
+
end
|
415
|
+
|
416
|
+
it 'is expected to delete /api/v2/organizations/org_id/invitations/invite_id' do
|
417
|
+
expect(@instance).to receive(:delete).with(
|
418
|
+
'/api/v2/organizations/org_id/invitations/invite_id'
|
419
|
+
)
|
420
|
+
@instance.delete_organizations_invite('org_id', 'invite_id')
|
421
|
+
end
|
422
|
+
|
423
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
424
|
+
expect { @instance.delete_organizations_invite(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'is expected to raise an exception when the invitation id is empty' do
|
428
|
+
expect { @instance.delete_organizations_invite('org_id', nil) }.to raise_error 'Must supply a valid invitation id'
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
context '.get_organizations_members' do
|
433
|
+
it 'is expected to respond to a get_organizations_members method' do
|
434
|
+
expect(@instance).to respond_to(:get_organizations_members)
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
438
|
+
expect { @instance.get_organizations_members(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
439
|
+
end
|
440
|
+
|
441
|
+
it 'is expected to get invitations for an org' do
|
442
|
+
expect(@instance).to receive(:get).with(
|
443
|
+
'/api/v2/organizations/org_id/members'
|
444
|
+
)
|
445
|
+
expect { @instance.get_organizations_members('org_id') }.not_to raise_error
|
446
|
+
end
|
447
|
+
|
448
|
+
it 'is expected to get members for an org' do
|
449
|
+
expect(@instance).to receive(:get).with(
|
450
|
+
'/api/v2/organizations/org_id/members'
|
451
|
+
)
|
452
|
+
expect do
|
453
|
+
@instance.get_organizations_members('org_id')
|
454
|
+
end.not_to raise_error
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
context '.create_organizations_members' do
|
459
|
+
it 'is expected to respond to a create_organizations_members method' do
|
460
|
+
expect(@instance).to respond_to(:create_organizations_members)
|
461
|
+
end
|
462
|
+
|
463
|
+
it 'is expected to respond to a add_organizations_members method' do
|
464
|
+
expect(@instance).to respond_to(:add_organizations_members)
|
465
|
+
end
|
466
|
+
|
467
|
+
it 'is expected to post /api/v2/organizations/org_id/members' do
|
468
|
+
expect(@instance).to receive(:post).with(
|
469
|
+
'/api/v2/organizations/org_id/members',
|
470
|
+
{
|
471
|
+
members: ['123', '456']
|
472
|
+
}
|
473
|
+
)
|
474
|
+
@instance.create_organizations_members('org_id', ['123', '456'])
|
475
|
+
end
|
476
|
+
|
477
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
478
|
+
expect { @instance.create_organizations_members(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
context '.delete_organizations_members' do
|
483
|
+
it 'is expected to respond to a delete_organizations_members method' do
|
484
|
+
expect(@instance).to respond_to(:delete_organizations_members)
|
485
|
+
end
|
486
|
+
|
487
|
+
it 'is expected to respond to a remove_organizations_members method' do
|
488
|
+
expect(@instance).to respond_to(:remove_organizations_members)
|
489
|
+
end
|
490
|
+
|
491
|
+
it 'is expected to delete /api/v2/organizations/org_id/members' do
|
492
|
+
expect(@instance).to receive(:delete).with(
|
493
|
+
'/api/v2/organizations/org_id/members', {
|
494
|
+
members: ['123', '456']
|
495
|
+
}
|
496
|
+
)
|
497
|
+
@instance.delete_organizations_members('org_id', ['123', '456'])
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
501
|
+
expect { @instance.delete_organizations_members(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
502
|
+
end
|
503
|
+
|
504
|
+
it 'is expected to raise an exception when the invitation id is empty' do
|
505
|
+
expect { @instance.delete_organizations_members('org_id', []) }.to raise_error 'Must supply an array of member ids'
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
context '.get_organizations_member_roles' do
|
510
|
+
it 'is expected to respond to a get_organizations_member_roles method' do
|
511
|
+
expect(@instance).to respond_to(:get_organizations_member_roles)
|
512
|
+
end
|
513
|
+
|
514
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
515
|
+
expect { @instance.get_organizations_member_roles(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
516
|
+
end
|
517
|
+
|
518
|
+
it 'is expected to raise an exception when the org ID is empty' do
|
519
|
+
expect { @instance.get_organizations_member_roles('org_id', nil) }.to raise_exception(Auth0::InvalidParameter)
|
520
|
+
end
|
521
|
+
|
522
|
+
it 'is expected to get roles for a member in an org' do
|
523
|
+
expect(@instance).to receive(:get).with(
|
524
|
+
'/api/v2/organizations/org_id/members/user_id/roles'
|
525
|
+
)
|
526
|
+
expect { @instance.get_organizations_member_roles('org_id', 'user_id') }.not_to raise_error
|
527
|
+
end
|
528
|
+
|
529
|
+
it 'is expected to get members for an org' do
|
530
|
+
expect(@instance).to receive(:get).with(
|
531
|
+
'/api/v2/organizations/org_id/members/user_id/roles'
|
532
|
+
)
|
533
|
+
expect do
|
534
|
+
@instance.get_organizations_member_roles('org_id', 'user_id')
|
535
|
+
end.not_to raise_error
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
context '.create_organizations_member_roles' do
|
540
|
+
it 'is expected to respond to a create_organizations_member_roles method' do
|
541
|
+
expect(@instance).to respond_to(:create_organizations_member_roles)
|
542
|
+
end
|
543
|
+
|
544
|
+
it 'is expected to respond to a add_organizations_member_roles method' do
|
545
|
+
expect(@instance).to respond_to(:add_organizations_member_roles)
|
546
|
+
end
|
547
|
+
|
548
|
+
it 'is expected to post /api/v2/organizations/org_id/members/user_id/roles' do
|
549
|
+
expect(@instance).to receive(:post).with(
|
550
|
+
'/api/v2/organizations/org_id/members/user_id/roles',
|
551
|
+
{
|
552
|
+
roles: ['123', '456']
|
553
|
+
}
|
554
|
+
)
|
555
|
+
@instance.create_organizations_member_roles('org_id', 'user_id', ['123', '456'])
|
556
|
+
end
|
557
|
+
|
558
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
559
|
+
expect { @instance.create_organizations_member_roles(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
560
|
+
end
|
561
|
+
end
|
562
|
+
|
563
|
+
context '.delete_organizations_member_roles' do
|
564
|
+
it 'is expected to respond to a delete_organizations_member_roles method' do
|
565
|
+
expect(@instance).to respond_to(:delete_organizations_member_roles)
|
566
|
+
end
|
567
|
+
|
568
|
+
it 'is expected to respond to a remove_organizations_member_roles method' do
|
569
|
+
expect(@instance).to respond_to(:remove_organizations_member_roles)
|
570
|
+
end
|
571
|
+
|
572
|
+
it 'is expected to delete /api/v2/organizations/org_id/members/user_id/roles' do
|
573
|
+
expect(@instance).to receive(:delete).with(
|
574
|
+
'/api/v2/organizations/org_id/members/user_id/roles', {
|
575
|
+
roles: ['123', '456']
|
576
|
+
}
|
577
|
+
)
|
578
|
+
@instance.delete_organizations_member_roles('org_id', 'user_id', ['123', '456'])
|
579
|
+
end
|
580
|
+
|
581
|
+
it 'is expected to raise an exception when the organization id is empty' do
|
582
|
+
expect { @instance.delete_organizations_member_roles(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
583
|
+
end
|
584
|
+
|
585
|
+
it 'is expected to raise an exception when the invitation id is empty' do
|
586
|
+
expect { @instance.delete_organizations_member_roles('org_id', nil, nil) }.to raise_error 'Must supply a valid user id'
|
587
|
+
end
|
588
|
+
|
589
|
+
it 'is expected to raise an exception when the invitation id is empty' do
|
590
|
+
expect { @instance.delete_organizations_member_roles('org_id', 'user_id') }.to raise_error 'Must supply an array of role ids'
|
591
|
+
end
|
592
|
+
end
|
593
|
+
end
|