auth0 3.6.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +7 -0
- data/.travis.yml +12 -7
- data/CHANGELOG.md +10 -0
- data/Gemfile +4 -2
- data/Guardfile +13 -10
- data/LICENSE +2 -2
- data/README.md +9 -11
- data/Rakefile +33 -7
- data/auth0.gemspec +12 -12
- data/deploy_documentation.sh +29 -0
- data/doc_config/templates/default/fulldoc/html/css/full_list.css +79 -0
- data/doc_config/templates/default/fulldoc/html/css/style.css +546 -0
- data/doc_config/templates/default/layout/html/breadcrumb.erb +11 -0
- data/doc_config/templates/default/layout/html/footer.erb +115 -0
- data/doc_config/templates/default/layout/html/headers.erb +17 -0
- data/doc_config/templates/default/layout/html/layout.erb +27 -0
- data/lib/auth0.rb +5 -5
- data/lib/auth0/api/authentication_endpoints.rb +264 -46
- data/lib/auth0/api/v1.rb +5 -5
- data/lib/auth0/api/v1/clients.rb +7 -7
- data/lib/auth0/api/v1/connections.rb +9 -10
- data/lib/auth0/api/v1/logs.rb +9 -16
- data/lib/auth0/api/v1/rules.rb +5 -5
- data/lib/auth0/api/v1/users.rb +28 -27
- data/lib/auth0/api/v2.rb +17 -9
- data/lib/auth0/api/v2/blacklists.rb +30 -9
- data/lib/auth0/api/v2/clients.rb +60 -19
- data/lib/auth0/api/v2/connections.rb +63 -10
- data/lib/auth0/api/v2/emails.rb +58 -0
- data/lib/auth0/api/v2/jobs.rb +44 -7
- data/lib/auth0/api/v2/rules.rb +104 -0
- data/lib/auth0/api/v2/stats.rb +22 -5
- data/lib/auth0/api/v2/tenants.rb +39 -0
- data/lib/auth0/api/v2/tickets.rb +58 -0
- data/lib/auth0/api/v2/users.rb +128 -39
- data/lib/auth0/client.rb +8 -6
- data/lib/auth0/exception.rb +29 -23
- data/lib/auth0/mixins.rb +12 -10
- data/lib/auth0/mixins/httparty_proxy.rb +13 -10
- data/lib/auth0/mixins/initializer.rb +25 -27
- data/lib/auth0/version.rb +2 -2
- data/spec/integration/lib/auth0/api/v1/api_clients_spec.rb +2 -4
- data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +25 -32
- data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +14 -0
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +61 -6
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +68 -42
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +71 -0
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +69 -0
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +83 -0
- data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +16 -0
- data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +37 -0
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +33 -0
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +88 -36
- data/spec/integration/lib/auth0/auth0_client_spec.rb +43 -35
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +253 -47
- data/spec/lib/auth0/api/v1/clients_spec.rb +37 -38
- data/spec/lib/auth0/api/v1/connections_spec.rb +44 -38
- data/spec/lib/auth0/api/v1/logs_spec.rb +24 -24
- data/spec/lib/auth0/api/v1/rules_spec.rb +23 -22
- data/spec/lib/auth0/api/v1/users_spec.rb +153 -130
- data/spec/lib/auth0/api/v2/blacklists_spec.rb +12 -11
- data/spec/lib/auth0/api/v2/clients_spec.rb +38 -33
- data/spec/lib/auth0/api/v2/connections_spec.rb +59 -34
- data/spec/lib/auth0/api/v2/emails_spec.rb +47 -0
- data/spec/lib/auth0/api/v2/jobs_spec.rb +24 -10
- data/spec/lib/auth0/api/v2/rules_spec.rb +69 -0
- data/spec/lib/auth0/api/v2/stats_spec.rb +11 -11
- data/spec/lib/auth0/api/v2/tenants_spec.rb +25 -0
- data/spec/lib/auth0/api/v2/tickets_spec.rb +31 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +101 -39
- data/spec/lib/auth0/client_spec.rb +46 -58
- data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +98 -69
- data/spec/lib/auth0/mixins/initializer_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/spec_helper_full.rb +16 -15
- data/spec/spec_helper_unit.rb +5 -5
- data/spec/support/credentials.rb +9 -3
- data/spec/support/dummy_class.rb +7 -1
- data/spec/support/dummy_class_for_proxy.rb +2 -2
- data/spec/support/import_users.json +13 -0
- data/spec/support/stub_response.rb +1 -2
- metadata +78 -41
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe Auth0::Api::V1::Clients do
|
3
3
|
before :all do
|
4
4
|
dummy_instance = DummyClass.new
|
@@ -6,57 +6,56 @@ describe Auth0::Api::V1::Clients do
|
|
6
6
|
@instance = dummy_instance
|
7
7
|
end
|
8
8
|
|
9
|
-
context
|
10
|
-
it {expect(@instance).to respond_to(:clients)}
|
11
|
-
it
|
12
|
-
expect(@instance).to receive(:get).with(
|
13
|
-
expect{@instance.clients}.not_to raise_error
|
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
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
context
|
18
|
-
it {expect(@instance).to respond_to(:create_client)}
|
19
|
-
it
|
20
|
-
client_name =
|
21
|
-
callbacks =
|
22
|
-
expect(@instance).to receive(:post).with(
|
23
|
-
expect{@instance.create_client(client_name, callbacks)}.not_to raise_error
|
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
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
28
|
-
it {expect(@instance).to respond_to(:create_client)}
|
29
|
-
it
|
30
|
-
client_name =
|
31
|
-
callbacks =
|
32
|
-
expect(@instance).to receive(:post).with(
|
33
|
-
expect{@instance.create_client(client_name, callbacks)}.not_to raise_error
|
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
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context
|
38
|
-
it {expect(@instance).to respond_to(:update_client)}
|
39
|
-
it
|
40
|
-
client_name =
|
41
|
-
callbacks =
|
42
|
-
expect(@instance).to receive(:put).with(
|
43
|
-
expect{@instance.update_client(client_name, callbacks,
|
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
44
|
end
|
45
45
|
|
46
|
-
it
|
47
|
-
expect(@instance).to receive(:warn).with(
|
48
|
-
@instance.update_client(
|
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
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
context
|
53
|
-
it {expect(@instance).to respond_to(:patch_client)}
|
54
|
-
it
|
55
|
-
client_name =
|
56
|
-
callbacks =
|
57
|
-
expect(@instance).to receive(:patch).with(
|
58
|
-
expect{@instance.patch_client(client_name, callbacks,
|
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
59
|
end
|
60
60
|
end
|
61
|
-
|
62
61
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe Auth0::Api::V1::Connections do
|
3
3
|
before :all do
|
4
4
|
dummy_instance = DummyClass.new
|
@@ -7,56 +7,62 @@ describe Auth0::Api::V1::Connections do
|
|
7
7
|
@instance = dummy_instance
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
11
|
-
it {expect(@instance).to respond_to(:connections)}
|
12
|
-
it {expect(@instance).to respond_to(:get_connections)}
|
13
|
-
it
|
14
|
-
expect(@instance).to receive(:get).with(
|
15
|
-
expect{@instance.connections}.not_to raise_error
|
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
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
context
|
20
|
-
it {expect(@instance).to respond_to(:connection)}
|
21
|
-
it
|
22
|
-
expect(@instance).to receive(:get).with(
|
23
|
-
expect{@instance.connection(
|
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
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
28
|
-
it {expect(@instance).to respond_to(:delete_connection)}
|
29
|
-
it
|
30
|
-
expect(@instance).to receive(:delete).with(
|
31
|
-
expect{@instance.delete_connection(
|
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
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
context
|
36
|
-
it {expect(@instance).to respond_to(:create_connection)}
|
37
|
-
it
|
38
|
-
params= { name:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
44
|
}
|
45
|
-
expect(@instance).to receive(:post).with(
|
46
|
-
expect
|
45
|
+
expect(@instance).to receive(:post).with('/api/connections', params)
|
46
|
+
expect do
|
47
|
+
@instance.create_connection(
|
48
|
+
'Some Test name',
|
49
|
+
'Unpredictable',
|
50
|
+
'google.com',
|
51
|
+
'test.google.com,auth0.com'
|
52
|
+
)
|
53
|
+
end.not_to raise_error
|
47
54
|
end
|
48
55
|
end
|
49
|
-
context
|
50
|
-
it {expect(@instance).to respond_to(:update_connection)}
|
51
|
-
it
|
52
|
-
params= { status: false,
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
context '.update_connection' do
|
57
|
+
it { expect(@instance).to respond_to(:update_connection) }
|
58
|
+
it 'is expected to send put to /api/connections/TestName' do
|
59
|
+
params = { status: false,
|
60
|
+
options: {
|
61
|
+
tenant_domain: 'google.com'
|
62
|
+
}
|
56
63
|
}
|
57
|
-
expect(@instance).to receive(:put).with(
|
58
|
-
expect{@instance.update_connection(
|
64
|
+
expect(@instance).to receive(:put).with('/api/connections/TestName', params)
|
65
|
+
expect { @instance.update_connection('TestName', 'google.com', false) }.not_to raise_error
|
59
66
|
end
|
60
67
|
end
|
61
|
-
|
62
68
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe Auth0::Api::V1::Logs do
|
3
3
|
before :all do
|
4
4
|
dummy_instance = DummyClass.new
|
@@ -7,40 +7,40 @@ describe Auth0::Api::V1::Logs do
|
|
7
7
|
@instance = dummy_instance
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
11
|
-
it {expect(@instance).to respond_to(:logs)}
|
12
|
-
it {expect(@instance).to respond_to(:search_logs)}
|
13
|
-
it
|
14
|
-
expect(@instance).to receive(:get).with(
|
15
|
-
expect{@instance.logs(
|
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
16
|
end
|
17
|
-
it
|
18
|
-
expect(@instance).to receive(:get).with(
|
19
|
-
expect{@instance.logs(
|
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
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
error_message =
|
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]'
|
24
26
|
expect(@instance).to receive(:warn).with(error_message)
|
25
|
-
@instance.logs(
|
27
|
+
@instance.logs('per_page' => 500, page: 3, random_stuff: 7)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
context
|
30
|
-
it {expect(@instance).to respond_to :log}
|
31
|
+
context '.log' do
|
32
|
+
it { expect(@instance).to respond_to :log }
|
31
33
|
it "is expected to get '/api/logs/te st'" do
|
32
|
-
expect(@instance).to receive(:get).with(
|
33
|
-
expect{@instance.log(
|
34
|
+
expect(@instance).to receive(:get).with('/api/logs/te st')
|
35
|
+
expect { @instance.log('te st') }.not_to raise_error
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
context
|
38
|
-
it {expect(@instance).to respond_to(:user_logs)}
|
39
|
-
it
|
40
|
-
expect(@instance).to receive(:get).with(
|
41
|
-
expect{@instance.user_logs(
|
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
|
42
44
|
end
|
43
45
|
end
|
44
|
-
|
45
|
-
|
46
46
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe Auth0::Api::V1::Rules do
|
3
3
|
before :all do
|
4
4
|
dummy_instance = DummyClass.new
|
@@ -7,34 +7,35 @@ describe Auth0::Api::V1::Rules do
|
|
7
7
|
@instance = dummy_instance
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
11
|
-
it {expect(@instance).to respond_to(:rules)}
|
12
|
-
it
|
13
|
-
expect(@instance).to receive(:get).with(
|
14
|
-
expect{@instance.rules}.not_to raise_error
|
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
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
context
|
19
|
-
it {expect(@instance).to respond_to(:create_rule)}
|
20
|
-
it
|
21
|
-
expect(@instance).to receive(:post).with(
|
22
|
-
|
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
|
+
expect { @instance.create_rule('test', 'script', 'order', 'status') }.not_to raise_error
|
23
25
|
end
|
24
26
|
end
|
25
|
-
context
|
26
|
-
it {expect(@instance).to respond_to(:update_rule)}
|
27
|
-
it
|
28
|
-
expect(@instance).to receive(:put).with(
|
29
|
-
expect{@instance.update_rule(
|
27
|
+
context '.update_rule' do
|
28
|
+
it { expect(@instance).to respond_to(:update_rule) }
|
29
|
+
it 'is expected to call put /api/rules/test' do
|
30
|
+
expect(@instance).to receive(:put).with('/api/rules/test', script: 'script', order: 'order', status: 'status')
|
31
|
+
expect { @instance.update_rule('test', 'script', 'order', 'status') }.not_to raise_error
|
30
32
|
end
|
31
33
|
end
|
32
|
-
context
|
33
|
-
it {expect(@instance).to respond_to(:delete_rule)}
|
34
|
-
it
|
35
|
-
expect(@instance).to receive(:delete).with(
|
36
|
-
expect{@instance.delete_rule(
|
34
|
+
context '.delete_rule' do
|
35
|
+
it { expect(@instance).to respond_to(:delete_rule) }
|
36
|
+
it 'is expected to call delete /api/rules/test' do
|
37
|
+
expect(@instance).to receive(:delete).with('/api/rules/test')
|
38
|
+
expect { @instance.delete_rule('test') }.not_to raise_error
|
37
39
|
end
|
38
40
|
end
|
39
|
-
|
40
41
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'securerandom'
|
3
3
|
|
4
4
|
describe Auth0::Api::V1::Users do
|
5
5
|
before :all do
|
@@ -8,210 +8,233 @@ describe Auth0::Api::V1::Users do
|
|
8
8
|
@instance = dummy_instance
|
9
9
|
end
|
10
10
|
|
11
|
-
context
|
12
|
-
it {expect(@instance).to respond_to(:users)}
|
13
|
-
it {expect(@instance).to respond_to(:users_search)}
|
14
|
-
it
|
15
|
-
expect(@instance).to receive(:get).with(
|
16
|
-
expect{@instance.users}.not_to raise_error
|
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
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
expect(@instance).to receive(:get).with(
|
21
|
-
expect{@instance.users(
|
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
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
context
|
26
|
-
it {expect(@instance).to respond_to(:user)}
|
27
|
-
it
|
28
|
-
expect(@instance).to receive(:get).with(
|
29
|
-
expect{@instance.user(
|
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
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
context
|
34
|
-
it {expect(@instance).to respond_to(:user_devices)}
|
35
|
-
it
|
36
|
-
expect(@instance).to receive(:get).with(
|
37
|
-
expect{@instance.user_devices(
|
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
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
context
|
42
|
-
it {expect(@instance).to respond_to(:connection_users)}
|
43
|
-
it {expect(@instance).to respond_to(:search_connection_users)}
|
44
|
-
it
|
45
|
-
expect(@instance).to receive(:get).with(
|
46
|
-
expect{@instance.connection_users(
|
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
47
|
end
|
48
48
|
|
49
|
-
it
|
50
|
-
|
51
|
-
expect
|
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
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
|
-
context
|
56
|
-
it{expect(@instance).to respond_to(:enterpriseconnections_users)}
|
57
|
-
it
|
58
|
-
expect(@instance).to receive(:get).with(
|
59
|
-
@instance.enterpriseconnections_users
|
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
|
60
61
|
end
|
61
62
|
|
62
|
-
it
|
63
|
-
expect(@instance).to receive(:get).with(
|
64
|
-
@instance.enterpriseconnections_users
|
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'
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
context
|
69
|
-
it{expect(@instance).to respond_to(:socialconnections_users)}
|
70
|
-
it
|
71
|
-
expect(@instance).to receive(:get).with(
|
72
|
-
@instance.socialconnections_users
|
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
|
73
74
|
end
|
74
|
-
it
|
75
|
-
expect(@instance).to receive(:get).with(
|
76
|
-
@instance.socialconnections_users
|
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'
|
77
78
|
end
|
78
|
-
it
|
79
|
-
expect(@instance).to receive(:get).with(
|
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')
|
80
81
|
@instance.socialconnections_users
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
84
|
-
context
|
85
|
-
it {expect(@instance).to respond_to(:client_users)}
|
86
|
-
it
|
87
|
-
expect(@instance).to receive(:get).with(
|
88
|
-
@instance.client_users(
|
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')
|
89
90
|
end
|
90
|
-
it
|
91
|
-
expect(@instance).to receive(:get).with(
|
92
|
-
expect{@instance.client_users
|
91
|
+
it 'is expected to call /api/client//users if no client_id passed' do
|
92
|
+
expect(@instance).to receive(:get).with('/api/clients//users')
|
93
|
+
expect { @instance.client_users }.not_to raise_error
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
96
|
-
context
|
97
|
-
it {expect(@instance).to respond_to(:create_user)}
|
98
|
-
it
|
99
|
-
expect(@instance).to receive(:post).with(
|
100
|
-
|
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
|
+
@instance.create_user('test@test.com', 'password', 'conn')
|
101
106
|
end
|
102
107
|
end
|
103
108
|
|
104
|
-
context
|
105
|
-
it {expect(@instance).to respond_to(:send_verification_email)}
|
106
|
-
it
|
107
|
-
expect(@instance).to receive(:post).with(
|
108
|
-
@instance.send_verification_email(
|
109
|
+
context '.send_verification_email' do
|
110
|
+
it { expect(@instance).to respond_to(:send_verification_email) }
|
111
|
+
it 'is expected to call post to /api/users/test/send_verification_email' do
|
112
|
+
expect(@instance).to receive(:post).with('/api/users/test/send_verification_email')
|
113
|
+
@instance.send_verification_email('test')
|
109
114
|
end
|
110
115
|
end
|
111
116
|
|
112
|
-
context
|
113
|
-
it {expect(@instance).to respond_to(:change_password_ticket)}
|
114
|
-
it
|
117
|
+
context '.change_password_ticket' do
|
118
|
+
it { expect(@instance).to respond_to(:change_password_ticket) }
|
119
|
+
it 'is expected to call post to /api/users/USERID/change_password_ticket' do
|
115
120
|
password = SecureRandom.hex
|
116
|
-
expect(@instance).to receive(:post).with(
|
117
|
-
|
121
|
+
expect(@instance).to receive(:post).with(
|
122
|
+
'/api/users/USERID/change_password_ticket',
|
123
|
+
'newPassword' => password, 'resultUrl' => nil)
|
124
|
+
@instance.change_password_ticket 'USERID', password
|
118
125
|
end
|
119
126
|
end
|
120
127
|
|
121
|
-
context
|
122
|
-
it {expect(@instance).to respond_to(:verification_ticket)}
|
123
|
-
it
|
124
|
-
expect(@instance).to receive(:post).with(
|
125
|
-
|
128
|
+
context '.verification_ticket' do
|
129
|
+
it { expect(@instance).to respond_to(:verification_ticket) }
|
130
|
+
it 'is expected to call post to /api/users/userId/verification_ticket if resulturl is set' do
|
131
|
+
expect(@instance).to receive(:post).with(
|
132
|
+
'/api/users/auth0|tdasfasdfasdfa/verification_ticket',
|
133
|
+
'resultUrl' => 'google.com')
|
134
|
+
@instance.verification_ticket('auth0|tdasfasdfasdfa', 'google.com')
|
126
135
|
end
|
127
|
-
it
|
128
|
-
|
129
|
-
@instance.
|
136
|
+
it 'is expected to call post to /api/users/userId/verification_ticket
|
137
|
+
if result url is empty' do
|
138
|
+
expect(@instance).to receive(:post).with(
|
139
|
+
'/api/users/auth0|tdasfasdfasdfa/verification_ticket',
|
140
|
+
'resultUrl' => nil)
|
141
|
+
@instance.verification_ticket('auth0|tdasfasdfasdfa')
|
130
142
|
end
|
131
143
|
end
|
132
144
|
|
133
|
-
context
|
134
|
-
it {expect(@instance).to respond_to(:create_public_key)}
|
135
|
-
it
|
136
|
-
expect(@instance).to receive(:post).with(
|
137
|
-
|
145
|
+
context '.create_public_key' do
|
146
|
+
it { expect(@instance).to respond_to(:create_public_key) }
|
147
|
+
it 'is expected to call post to /api/users/userId/public_key' do
|
148
|
+
expect(@instance).to receive(:post).with(
|
149
|
+
'/api/users/auth0|tdasfasdfasdfa/public_key',
|
150
|
+
device: 'device22', public_key: 'SuperSecurePK')
|
151
|
+
@instance.create_public_key('auth0|tdasfasdfasdfa', 'device22', 'SuperSecurePK')
|
138
152
|
end
|
139
153
|
end
|
140
154
|
|
141
|
-
context
|
142
|
-
it {expect(@instance).to respond_to(:update_user_email)}
|
143
|
-
it
|
144
|
-
expect(@instance).to receive(:put).with(
|
145
|
-
@instance.update_user_email(
|
155
|
+
context '.update_user_email' do
|
156
|
+
it { expect(@instance).to respond_to(:update_user_email) }
|
157
|
+
it 'is expected to call put to /api/users/auth0|tdasfasdfasdfa/email' do
|
158
|
+
expect(@instance).to receive(:put).with('/api/users/auth0|tdasfasdfasdfa/email', email: 'email', verify: true)
|
159
|
+
@instance.update_user_email('auth0|tdasfasdfasdfa', 'email')
|
146
160
|
end
|
147
161
|
end
|
148
162
|
|
149
|
-
context
|
150
|
-
it {expect(@instance).to respond_to :update_user_metadata}
|
151
|
-
it
|
152
|
-
expect(@instance).to receive(:put).with(
|
153
|
-
@instance.update_user_metadata
|
163
|
+
context '.update_user_metadata' do
|
164
|
+
it { expect(@instance).to respond_to :update_user_metadata }
|
165
|
+
it 'is expected to call put to /api/users/userId/metadata' do
|
166
|
+
expect(@instance).to receive(:put).with('/api/users/userId/metadata', supersecret_users_data: '3')
|
167
|
+
@instance.update_user_metadata 'userId', supersecret_users_data: '3'
|
154
168
|
end
|
155
169
|
end
|
156
170
|
|
157
|
-
context
|
158
|
-
it {expect(@instance).to respond_to(:update_user_password)}
|
159
|
-
it
|
160
|
-
expect(@instance).to receive(:put).with(
|
161
|
-
|
171
|
+
context '.update_user_password' do
|
172
|
+
it { expect(@instance).to respond_to(:update_user_password) }
|
173
|
+
it 'is expected to call put to /api/users/auth0|tdasfasdfasdfa/password' do
|
174
|
+
expect(@instance).to receive(:put).with(
|
175
|
+
'/api/users/auth0|tdasfasdfasdfa/password',
|
176
|
+
password: 'password',
|
177
|
+
verify: true)
|
178
|
+
@instance.update_user_password('auth0|tdasfasdfasdfa', 'password')
|
162
179
|
end
|
163
180
|
end
|
164
181
|
|
165
|
-
context
|
166
|
-
it {expect(@instance).to respond_to(:update_user_password_using_email)}
|
167
|
-
it
|
168
|
-
expect(@instance).to receive(:put).with(
|
169
|
-
|
182
|
+
context '.update_user_password_using_email' do
|
183
|
+
it { expect(@instance).to respond_to(:update_user_password_using_email) }
|
184
|
+
it 'is expected to call put to /api/users/email@email.com/password' do
|
185
|
+
expect(@instance).to receive(:put).with(
|
186
|
+
'/api/users/email@email.com/password',
|
187
|
+
email: 'email@email.com',
|
188
|
+
password: 'password',
|
189
|
+
connection: 'Con',
|
190
|
+
verify: true)
|
191
|
+
@instance.update_user_password_using_email(
|
192
|
+
'email@email.com', 'password', 'Con')
|
170
193
|
end
|
171
194
|
end
|
172
195
|
|
173
|
-
context
|
174
|
-
it {expect(@instance).to respond_to :patch_user_metadata}
|
175
|
-
it
|
176
|
-
expect(@instance).to receive(:patch).with(
|
177
|
-
@instance.patch_user_metadata
|
196
|
+
context '.patch_user_metadata' do
|
197
|
+
it { expect(@instance).to respond_to :patch_user_metadata }
|
198
|
+
it 'is expected to call patch to /api/users/userId/metadata' do
|
199
|
+
expect(@instance).to receive(:patch).with('/api/users/userId/metadata', supersecret_users_data: '3')
|
200
|
+
@instance.patch_user_metadata 'userId', supersecret_users_data: '3'
|
178
201
|
end
|
179
202
|
end
|
180
203
|
|
181
|
-
context
|
182
|
-
it {expect(@instance).to respond_to :delete_users}
|
183
|
-
it
|
184
|
-
expect(@instance).to receive(:delete).with(
|
204
|
+
context '.delete_users' do
|
205
|
+
it { expect(@instance).to respond_to :delete_users }
|
206
|
+
it 'is expected to call delete to /api/users' do
|
207
|
+
expect(@instance).to receive(:delete).with('/api/users/')
|
185
208
|
@instance.delete_users
|
186
209
|
end
|
187
210
|
end
|
188
211
|
|
189
|
-
context
|
190
|
-
it {expect(@instance).to respond_to(:delete_user)}
|
191
|
-
it
|
192
|
-
expect(@instance).to receive(:delete).with(
|
193
|
-
@instance.delete_user(
|
212
|
+
context '.delete_user' do
|
213
|
+
it { expect(@instance).to respond_to(:delete_user) }
|
214
|
+
it 'is expected to call delete to /api/users/userId' do
|
215
|
+
expect(@instance).to receive(:delete).with('/api/users/userId')
|
216
|
+
@instance.delete_user('userId')
|
194
217
|
end
|
195
218
|
|
196
|
-
it
|
219
|
+
it 'is expected not to call delete to /api/users if user_id is blank' do
|
197
220
|
expect(@instance).not_to receive(:delete)
|
198
|
-
expect{@instance.delete_user(
|
221
|
+
expect { @instance.delete_user('') }.to raise_exception(Auth0::MissingUserId)
|
199
222
|
end
|
200
223
|
end
|
201
224
|
|
202
|
-
context
|
203
|
-
it {expect(@instance).to respond_to(:revoke_user_refresh_token)}
|
204
|
-
it
|
205
|
-
expect(@instance).to receive(:delete).with(
|
206
|
-
@instance.revoke_user_refresh_token(
|
225
|
+
context '.revoke_user_refresh_token' do
|
226
|
+
it { expect(@instance).to respond_to(:revoke_user_refresh_token) }
|
227
|
+
it 'is expected to call delete to /api/users/user_id/refresh_tokens/refresh_token' do
|
228
|
+
expect(@instance).to receive(:delete).with('/api/users/user_id/refresh_tokens/refresh_token')
|
229
|
+
@instance.revoke_user_refresh_token('user_id', 'refresh_token')
|
207
230
|
end
|
208
231
|
end
|
209
232
|
|
210
|
-
context
|
211
|
-
it {expect(@instance).to respond_to(:revoke_user_device_public_key)}
|
212
|
-
it
|
213
|
-
expect(@instance).to receive(:delete).with(
|
214
|
-
@instance.revoke_user_device_public_key(
|
233
|
+
context '.revoke_user_device_public_key' do
|
234
|
+
it { expect(@instance).to respond_to(:revoke_user_device_public_key) }
|
235
|
+
it 'is expected to call delete to /api/users/user_id/publickey?device=device' do
|
236
|
+
expect(@instance).to receive(:delete).with('/api/users/user_id/publickey?device=device')
|
237
|
+
@instance.revoke_user_device_public_key('user_id', 'device')
|
215
238
|
end
|
216
239
|
end
|
217
240
|
end
|