auth0 4.1.0 → 4.4.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.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +38 -0
  3. data/DEPLOYMENT.md +10 -1
  4. data/Dockerfile +5 -0
  5. data/README.md +14 -17
  6. data/RUBYGEM.md +9 -0
  7. data/auth0.gemspec +2 -2
  8. data/examples/ruby-api/.env.example +2 -0
  9. data/examples/ruby-on-rails-api/.env.example +2 -0
  10. data/examples/ruby-on-rails-api/Gemfile +7 -7
  11. data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +2 -2
  12. data/examples/ruby-on-rails-api/app/models/User.rb +5 -0
  13. data/examples/ruby-on-rails-api/config/initializers/knock.rb +2 -20
  14. data/lib/auth0/api/authentication_endpoints.rb +10 -9
  15. data/lib/auth0/api/v2.rb +2 -0
  16. data/lib/auth0/api/v2/users.rb +1 -0
  17. data/lib/auth0/api/v2/users_by_email.rb +35 -0
  18. data/lib/auth0/exception.rb +2 -0
  19. data/lib/auth0/mixins/httpproxy.rb +6 -1
  20. data/lib/auth0/version.rb +1 -1
  21. data/publish_rubygem.sh +10 -0
  22. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +3 -43
  23. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +26 -17
  24. data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +45 -9
  25. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +58 -13
  26. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +22 -4
  27. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +66 -22
  28. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +38 -24
  29. data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +15 -2
  30. data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +52 -16
  31. data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +12 -3
  32. data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +21 -5
  33. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +15 -3
  34. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +58 -37
  35. data/spec/integration/lib/auth0/auth0_client_spec.rb +1 -1
  36. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +5 -3
  37. data/spec/lib/auth0/api/v2/users_by_email_spec.rb +21 -0
  38. data/spec/lib/auth0/client_spec.rb +0 -61
  39. data/spec/spec_helper.rb +23 -0
  40. data/spec/spec_helper_full.rb +8 -19
  41. data/spec/spec_helper_unit.rb +0 -9
  42. data/spec/support/credentials.rb +2 -0
  43. data/spec/support/dummy_class.rb +1 -1
  44. metadata +55 -107
  45. data/spec/integration/lib/auth0/api/v1/api_clients_spec.rb +0 -12
  46. data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +0 -52
  47. data/spec/lib/auth0/api/v1/clients_spec.rb +0 -61
  48. data/spec/lib/auth0/api/v1/connections_spec.rb +0 -66
  49. data/spec/lib/auth0/api/v1/logs_spec.rb +0 -46
  50. data/spec/lib/auth0/api/v1/rules_spec.rb +0 -42
  51. data/spec/lib/auth0/api/v1/users_spec.rb +0 -248
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Clients do
3
- let(:client) { Auth0Client.new(v1_creds) }
4
- let(:global_client) { Auth0Client.new(v1_global_creds) }
5
- let(:client_name) { "client#{entity_suffix}" }
6
-
7
- it { expect(client.clients).to_not be_empty }
8
-
9
- it { expect { client.create_client(client_name) }.to raise_error(Auth0::Unauthorized) }
10
-
11
- it { expect(global_client.create_client(client_name)).to_not be_nil }
12
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Users do
3
- let(:client) { Auth0Client.new(v1_creds) }
4
- let(:username) { Faker::Internet.user_name }
5
- let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
6
- let(:password) { Faker::Internet.password }
7
- let!(:user) do
8
- client.create_user(email, password, Auth0::Api::AuthenticationEndpoints::UP_AUTH,
9
- 'username' => username, 'email_verified' => false)
10
- end
11
-
12
- skip 'Users examples are skipped' do
13
- describe '.users' do
14
- let(:users) { client.users }
15
-
16
- it { expect(users.size).to be > 0 }
17
-
18
- context '#filters' do
19
- it { expect(client.users("email: #{email}").size).to be 1 }
20
- end
21
- end
22
- end
23
-
24
- describe '.user' do
25
- let(:subject) { client.user(user['user_id']) }
26
-
27
- it { should include('email' => email, 'username' => username) }
28
- end
29
-
30
- describe '.create_user' do
31
- let(:subject) { user }
32
-
33
- it { should include('user_id', 'identities') }
34
- it do
35
- should include(
36
- 'username' => username,
37
- 'email' => email,
38
- 'email_verified' => false
39
- )
40
- end
41
- end
42
-
43
- describe '.delete_user' do
44
- it { expect { client.delete_user user['user_id'] }.to_not raise_error }
45
-
46
- it { expect { client.delete_user '' }.to raise_error(Auth0::MissingUserId) }
47
- end
48
-
49
- describe '.patch_user_metadata' do
50
- it { expect(client.patch_user_metadata(user['user_id'], 'custom_field' => 'custom_value')).to eq 'OK' }
51
- end
52
- end
@@ -1,61 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Clients do
3
- before :all do
4
- dummy_instance = DummyClass.new
5
- dummy_instance.extend(Auth0::Api::V1::Clients)
6
- @instance = dummy_instance
7
- end
8
-
9
- context '.clients' do
10
- it { expect(@instance).to respond_to(:clients) }
11
- it 'is expected to send get request to /api/clients' do
12
- expect(@instance).to receive(:get).with('/api/clients')
13
- expect { @instance.clients }.not_to raise_error
14
- end
15
- end
16
-
17
- context '.create_client' do
18
- it { expect(@instance).to respond_to(:create_client) }
19
- it 'is expected to send post request to /api/clients' do
20
- client_name = 'ClientRandomName'
21
- callbacks = 'Some absolutely random stuff here'
22
- expect(@instance).to receive(:post).with('/api/clients', name: client_name, callbacks: callbacks)
23
- expect { @instance.create_client(client_name, callbacks) }.not_to raise_error
24
- end
25
- end
26
-
27
- context '.create_client' do
28
- it { expect(@instance).to respond_to(:create_client) }
29
- it 'is expected to send post request to /api/clients' do
30
- client_name = 'Some random name'
31
- callbacks = 'Some random stuff'
32
- expect(@instance).to receive(:post).with('/api/clients', name: client_name, callbacks: callbacks)
33
- expect { @instance.create_client(client_name, callbacks) }.not_to raise_error
34
- end
35
- end
36
-
37
- context '.update_client' do
38
- it { expect(@instance).to respond_to(:update_client) }
39
- it 'is expected to perform put to /api/clients/#client_id' do
40
- client_name = 'Some random name'
41
- callbacks = 'Some random stuff'
42
- expect(@instance).to receive(:put).with('/api/clients/client_id', name: client_name, callbacks: callbacks)
43
- expect { @instance.update_client(client_name, callbacks, 'client_id') }.not_to raise_error
44
- end
45
-
46
- it 'is expected to make warn on deprecated endpoint' do
47
- expect(@instance).to receive(:warn).with('This endpoint has been deprecated in favor of PATCH.')
48
- @instance.update_client('test')
49
- end
50
- end
51
-
52
- context '.patch_client' do
53
- it { expect(@instance).to respond_to(:patch_client) }
54
- it 'is expected to perform patch to /api/clients/#client_id' do
55
- client_name = 'Some random name'
56
- callbacks = 'Some random stuff'
57
- expect(@instance).to receive(:patch).with('/api/clients/client_id', name: client_name, callbacks: callbacks)
58
- expect { @instance.patch_client(client_name, callbacks, 'client_id') }.not_to raise_error
59
- end
60
- end
61
- end
@@ -1,66 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Connections do
3
- before :all do
4
- dummy_instance = DummyClass.new
5
- dummy_instance.extend(Auth0::Api::V1::Connections)
6
- dummy_instance.extend(Auth0::Mixins::Initializer)
7
- @instance = dummy_instance
8
- end
9
-
10
- context '.connections' do
11
- it { expect(@instance).to respond_to(:connections) }
12
- it { expect(@instance).to respond_to(:get_connections) }
13
- it 'is expected to send get request to /api/connections' do
14
- expect(@instance).to receive(:get).with('/api/connections')
15
- expect { @instance.connections }.not_to raise_error
16
- end
17
- end
18
-
19
- context '.connection' do
20
- it { expect(@instance).to respond_to(:connection) }
21
- it 'it is expected to send get request to /api/connections/RandomConnectionName' do
22
- expect(@instance).to receive(:get).with('/api/connections/RandomConnectionName')
23
- expect { @instance.connection('RandomConnectionName') }.not_to raise_error
24
- end
25
- end
26
-
27
- context '.delete_connection' do
28
- it { expect(@instance).to respond_to(:delete_connection) }
29
- it 'it is expected to send delete request to /api/connections/RandomConnectionName' do
30
- expect(@instance).to receive(:delete).with('/api/connections/RandomConnectionName')
31
- expect { @instance.delete_connection('RandomConnectionName') }.not_to raise_error
32
- end
33
- end
34
-
35
- context '.create_connection' do
36
- it { expect(@instance).to respond_to(:create_connection) }
37
- it 'is expected to send post to /api/connections' do
38
- params = { name: 'Some Test name',
39
- strategy: 'Unpredictable',
40
- options: {
41
- tenant_domain: 'google.com',
42
- domain_aliases: 'test.google.com,auth0.com'
43
- } }
44
- expect(@instance).to receive(:post).with('/api/connections', params)
45
- expect do
46
- @instance.create_connection(
47
- 'Some Test name',
48
- 'Unpredictable',
49
- 'google.com',
50
- 'test.google.com,auth0.com'
51
- )
52
- end.not_to raise_error
53
- end
54
- end
55
- context '.update_connection' do
56
- it { expect(@instance).to respond_to(:update_connection) }
57
- it 'is expected to send put to /api/connections/TestName' do
58
- params = { status: false,
59
- options: {
60
- tenant_domain: 'google.com'
61
- } }
62
- expect(@instance).to receive(:put).with('/api/connections/TestName', params)
63
- expect { @instance.update_connection('TestName', 'google.com', false) }.not_to raise_error
64
- end
65
- end
66
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Logs do
3
- before :all do
4
- dummy_instance = DummyClass.new
5
- dummy_instance.extend(Auth0::Api::V1::Logs)
6
- dummy_instance.extend(Auth0::Mixins::Initializer)
7
- @instance = dummy_instance
8
- end
9
-
10
- context '.logs or .search_logs' do
11
- it { expect(@instance).to respond_to(:logs) }
12
- it { expect(@instance).to respond_to(:search_logs) }
13
- it 'should call path with all provided params per_page' do
14
- expect(@instance).to receive(:get).with('/api/logs?per_page=500')
15
- expect { @instance.logs('per_page' => 500) }.not_to raise_error
16
- end
17
- it 'should call path with all provided params per_page, page' do
18
- expect(@instance).to receive(:get).with('/api/logs?per_page=500&page=3')
19
- expect { @instance.logs('per_page' => 500, page: 3) }.not_to raise_error
20
- end
21
-
22
- it 'should raise warn if any garbage params are passed' do
23
- error_message = 'random_stuff is not in acceptable params list: '\
24
- '[:take, :from, :search_criteria, :page, :per_page, :sort, :fields, '\
25
- ':exclude_fields]'
26
- expect(@instance).to receive(:warn).with(error_message)
27
- @instance.logs('per_page' => 500, page: 3, random_stuff: 7)
28
- end
29
- end
30
-
31
- context '.log' do
32
- it { expect(@instance).to respond_to :log }
33
- it "is expected to get '/api/logs/te st'" do
34
- expect(@instance).to receive(:get).with('/api/logs/te st')
35
- expect { @instance.log('te st') }.not_to raise_error
36
- end
37
- end
38
-
39
- context '.user_logs' do
40
- it { expect(@instance).to respond_to(:user_logs) }
41
- it 'is expected to get /api/users/#user_id/logs' do
42
- expect(@instance).to receive(:get).with('/api/users/auth0|test test/logs?page=0&per_page=50')
43
- expect { @instance.user_logs('auth0|test test') }.not_to raise_error
44
- end
45
- end
46
- end
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
- describe Auth0::Api::V1::Rules do
3
- before :all do
4
- dummy_instance = DummyClass.new
5
- dummy_instance.extend(Auth0::Api::V1::Rules)
6
- dummy_instance.extend(Auth0::Mixins::Initializer)
7
- @instance = dummy_instance
8
- end
9
-
10
- context '.rules' do
11
- it { expect(@instance).to respond_to(:rules) }
12
- it 'is expected to call get /api/rules' do
13
- expect(@instance).to receive(:get).with('/api/rules')
14
- expect { @instance.rules }.not_to raise_error
15
- end
16
- end
17
-
18
- context '.create_rule' do
19
- it { expect(@instance).to respond_to(:create_rule) }
20
- it 'is expected to call post /api/rules' do
21
- expect(@instance).to receive(:post).with(
22
- '/api/rules',
23
- name: 'test', script: 'script', order: 'order', status: 'status'
24
- )
25
- expect { @instance.create_rule('test', 'script', 'order', 'status') }.not_to raise_error
26
- end
27
- end
28
- context '.update_rule' do
29
- it { expect(@instance).to respond_to(:update_rule) }
30
- it 'is expected to call put /api/rules/test' do
31
- expect(@instance).to receive(:put).with('/api/rules/test', script: 'script', order: 'order', status: 'status')
32
- expect { @instance.update_rule('test', 'script', 'order', 'status') }.not_to raise_error
33
- end
34
- end
35
- context '.delete_rule' do
36
- it { expect(@instance).to respond_to(:delete_rule) }
37
- it 'is expected to call delete /api/rules/test' do
38
- expect(@instance).to receive(:delete).with('/api/rules/test')
39
- expect { @instance.delete_rule('test') }.not_to raise_error
40
- end
41
- end
42
- end
@@ -1,248 +0,0 @@
1
- require 'spec_helper'
2
- require 'securerandom'
3
-
4
- describe Auth0::Api::V1::Users do
5
- before :all do
6
- dummy_instance = DummyClass.new
7
- dummy_instance.extend(Auth0::Api::V1::Users)
8
- @instance = dummy_instance
9
- end
10
-
11
- context '.users' do
12
- it { expect(@instance).to respond_to(:users) }
13
- it { expect(@instance).to respond_to(:users_search) }
14
- it 'is expected to call /api/users when search is nill' do
15
- expect(@instance).to receive(:get).with('/api/users')
16
- expect { @instance.users }.not_to raise_error
17
- end
18
-
19
- it 'is expected to call /api/users?search=search_criteria when search is search_criteria' do
20
- expect(@instance).to receive(:get).with('/api/users?search=search_criteria')
21
- expect { @instance.users('search_criteria') }.not_to raise_error
22
- end
23
- end
24
-
25
- context '.user' do
26
- it { expect(@instance).to respond_to(:user) }
27
- it 'is expected to call get request to /api/users/USER_ID' do
28
- expect(@instance).to receive(:get).with('/api/users/USER_ID')
29
- expect { @instance.user('USER_ID') }.not_to raise_error
30
- end
31
- end
32
-
33
- context '.user_devices' do
34
- it { expect(@instance).to respond_to(:user_devices) }
35
- it 'is expected to call /api/users when search is nill' do
36
- expect(@instance).to receive(:get).with('/api/users/USER_ID/devices')
37
- expect { @instance.user_devices('USER_ID') }.not_to raise_error
38
- end
39
- end
40
-
41
- context '.connection_users' do
42
- it { expect(@instance).to respond_to(:connection_users) }
43
- it { expect(@instance).to respond_to(:search_connection_users) }
44
- it 'is expected to call /api/connections/CONNECTION_ID/users/ when search is nill' do
45
- expect(@instance).to receive(:get).with('/api/connections/CONNECTION_ID/users')
46
- expect { @instance.connection_users('CONNECTION_ID') }.not_to raise_error
47
- end
48
-
49
- it 'is expected to call
50
- /api/connections/CONNECTION_ID/users?search=search_criteria when search is search_criteria' do
51
- expect(@instance).to receive(:get).with('/api/connections/CONNECTION_ID/users?search=search_criteria')
52
- expect { @instance.connection_users('CONNECTION_ID', 'search_criteria') }.not_to raise_error
53
- end
54
- end
55
-
56
- context '.enterpriseconnections_users' do
57
- it { expect(@instance).to respond_to(:enterpriseconnections_users) }
58
- it 'is expected to call get to /api/enterpriseconnections/users' do
59
- expect(@instance).to receive(:get).with('/api/enterpriseconnections/users?search=arr a&per_page=11')
60
- @instance.enterpriseconnections_users 'arr a', 11
61
- end
62
-
63
- it 'is expected to call get to /api/enterpriseconnections/users?search=dfasdf&per_page=500' do
64
- expect(@instance).to receive(:get).with('/api/enterpriseconnections/users?search=arr a&per_page=500')
65
- @instance.enterpriseconnections_users 'arr a'
66
- end
67
- end
68
-
69
- context '.socialconnections_users' do
70
- it { expect(@instance).to respond_to(:socialconnections_users) }
71
- it 'is expected to call get to /api/socialconnections/users' do
72
- expect(@instance).to receive(:get).with('/api/socialconnections/users?search=arr a&per_page=11')
73
- @instance.socialconnections_users 'arr a', 11
74
- end
75
- it 'is expected to call get to /api/socialconnections/users' do
76
- expect(@instance).to receive(:get).with('/api/socialconnections/users?search=arr a&per_page=500')
77
- @instance.socialconnections_users 'arr a'
78
- end
79
- it 'is expected to call get to /api/socialconnections/users' do
80
- expect(@instance).to receive(:get).with('/api/socialconnections/users?search=&per_page=500')
81
- @instance.socialconnections_users
82
- end
83
- end
84
-
85
- context '.client_users' do
86
- it { expect(@instance).to respond_to(:client_users) }
87
- it 'is expected to call /api/client/test_client_id/users through get' do
88
- expect(@instance).to receive(:get).with('/api/clients/test_client_id/users')
89
- @instance.client_users('test_client_id')
90
- end
91
- it 'is expected to call /api/client//users if no client_id passed' do
92
- expect(@instance).to receive(:get).with("/api/clients/#{@instance.client_id}/users")
93
- expect { @instance.client_users }.not_to raise_error
94
- end
95
- end
96
-
97
- context '.create_user' do
98
- it { expect(@instance).to respond_to(:create_user) }
99
- it 'is expected to call post to /api/users' do
100
- expect(@instance).to receive(:post).with(
101
- '/api/users',
102
- email: 'test@test.com',
103
- password: 'password',
104
- connection: 'conn'
105
- )
106
- @instance.create_user('test@test.com', 'password', 'conn')
107
- end
108
- end
109
-
110
- context '.send_verification_email' do
111
- it { expect(@instance).to respond_to(:send_verification_email) }
112
- it 'is expected to call post to /api/users/test/send_verification_email' do
113
- expect(@instance).to receive(:post).with('/api/users/test/send_verification_email')
114
- @instance.send_verification_email('test')
115
- end
116
- end
117
-
118
- context '.change_password_ticket' do
119
- it { expect(@instance).to respond_to(:change_password_ticket) }
120
- it 'is expected to call post to /api/users/USERID/change_password_ticket' do
121
- password = SecureRandom.hex
122
- expect(@instance).to receive(:post).with(
123
- '/api/users/USERID/change_password_ticket',
124
- 'newPassword' => password, 'resultUrl' => nil
125
- )
126
- @instance.change_password_ticket 'USERID', password
127
- end
128
- end
129
-
130
- context '.verification_ticket' do
131
- it { expect(@instance).to respond_to(:verification_ticket) }
132
- it 'is expected to call post to /api/users/userId/verification_ticket if resulturl is set' do
133
- expect(@instance).to receive(:post).with(
134
- '/api/users/auth0|tdasfasdfasdfa/verification_ticket',
135
- 'resultUrl' => 'google.com'
136
- )
137
- @instance.verification_ticket('auth0|tdasfasdfasdfa', 'google.com')
138
- end
139
- it 'is expected to call post to /api/users/userId/verification_ticket
140
- if result url is empty' do
141
- expect(@instance).to receive(:post).with(
142
- '/api/users/auth0|tdasfasdfasdfa/verification_ticket',
143
- 'resultUrl' => nil
144
- )
145
- @instance.verification_ticket('auth0|tdasfasdfasdfa')
146
- end
147
- end
148
-
149
- context '.create_public_key' do
150
- it { expect(@instance).to respond_to(:create_public_key) }
151
- it 'is expected to call post to /api/users/userId/public_key' do
152
- expect(@instance).to receive(:post).with(
153
- '/api/users/auth0|tdasfasdfasdfa/public_key',
154
- device: 'device22', public_key: 'SuperSecurePK'
155
- )
156
- @instance.create_public_key('auth0|tdasfasdfasdfa', 'device22', 'SuperSecurePK')
157
- end
158
- end
159
-
160
- context '.update_user_email' do
161
- it { expect(@instance).to respond_to(:update_user_email) }
162
- it 'is expected to call put to /api/users/auth0|tdasfasdfasdfa/email' do
163
- expect(@instance).to receive(:put).with('/api/users/auth0|tdasfasdfasdfa/email', email: 'email', verify: true)
164
- @instance.update_user_email('auth0|tdasfasdfasdfa', 'email')
165
- end
166
- end
167
-
168
- context '.update_user_metadata' do
169
- it { expect(@instance).to respond_to :update_user_metadata }
170
- it 'is expected to call put to /api/users/userId/metadata' do
171
- expect(@instance).to receive(:put).with('/api/users/userId/metadata', supersecret_users_data: '3')
172
- @instance.update_user_metadata 'userId', supersecret_users_data: '3'
173
- end
174
- end
175
-
176
- context '.update_user_password' do
177
- it { expect(@instance).to respond_to(:update_user_password) }
178
- it 'is expected to call put to /api/users/auth0|tdasfasdfasdfa/password' do
179
- expect(@instance).to receive(:put).with(
180
- '/api/users/auth0|tdasfasdfasdfa/password',
181
- password: 'password',
182
- verify: true
183
- )
184
- @instance.update_user_password('auth0|tdasfasdfasdfa', 'password')
185
- end
186
- end
187
-
188
- context '.update_user_password_using_email' do
189
- it { expect(@instance).to respond_to(:update_user_password_using_email) }
190
- it 'is expected to call put to /api/users/email@email.com/password' do
191
- expect(@instance).to receive(:put).with(
192
- '/api/users/email@email.com/password',
193
- email: 'email@email.com',
194
- password: 'password',
195
- connection: 'Con',
196
- verify: true
197
- )
198
- @instance.update_user_password_using_email(
199
- 'email@email.com', 'password', 'Con'
200
- )
201
- end
202
- end
203
-
204
- context '.patch_user_metadata' do
205
- it { expect(@instance).to respond_to :patch_user_metadata }
206
- it 'is expected to call patch to /api/users/userId/metadata' do
207
- expect(@instance).to receive(:patch).with('/api/users/userId/metadata', supersecret_users_data: '3')
208
- @instance.patch_user_metadata 'userId', supersecret_users_data: '3'
209
- end
210
- end
211
-
212
- context '.delete_users' do
213
- it { expect(@instance).to respond_to :delete_users }
214
- it 'is expected to call delete to /api/users' do
215
- expect(@instance).to receive(:delete).with('/api/users/')
216
- @instance.delete_users
217
- end
218
- end
219
-
220
- context '.delete_user' do
221
- it { expect(@instance).to respond_to(:delete_user) }
222
- it 'is expected to call delete to /api/users/userId' do
223
- expect(@instance).to receive(:delete).with('/api/users/userId')
224
- @instance.delete_user('userId')
225
- end
226
-
227
- it 'is expected not to call delete to /api/users if user_id is blank' do
228
- expect(@instance).not_to receive(:delete)
229
- expect { @instance.delete_user('') }.to raise_exception(Auth0::MissingUserId)
230
- end
231
- end
232
-
233
- context '.revoke_user_refresh_token' do
234
- it { expect(@instance).to respond_to(:revoke_user_refresh_token) }
235
- it 'is expected to call delete to /api/users/user_id/refresh_tokens/refresh_token' do
236
- expect(@instance).to receive(:delete).with('/api/users/user_id/refresh_tokens/refresh_token')
237
- @instance.revoke_user_refresh_token('user_id', 'refresh_token')
238
- end
239
- end
240
-
241
- context '.revoke_user_device_public_key' do
242
- it { expect(@instance).to respond_to(:revoke_user_device_public_key) }
243
- it 'is expected to call delete to /api/users/user_id/publickey?device=device' do
244
- expect(@instance).to receive(:delete).with('/api/users/user_id/publickey?device=device')
245
- @instance.revoke_user_device_public_key('user_id', 'device')
246
- end
247
- end
248
- end