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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +38 -0
- data/DEPLOYMENT.md +10 -1
- data/Dockerfile +5 -0
- data/README.md +14 -17
- data/RUBYGEM.md +9 -0
- data/auth0.gemspec +2 -2
- data/examples/ruby-api/.env.example +2 -0
- data/examples/ruby-on-rails-api/.env.example +2 -0
- data/examples/ruby-on-rails-api/Gemfile +7 -7
- data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +2 -2
- data/examples/ruby-on-rails-api/app/models/User.rb +5 -0
- data/examples/ruby-on-rails-api/config/initializers/knock.rb +2 -20
- data/lib/auth0/api/authentication_endpoints.rb +10 -9
- data/lib/auth0/api/v2.rb +2 -0
- data/lib/auth0/api/v2/users.rb +1 -0
- data/lib/auth0/api/v2/users_by_email.rb +35 -0
- data/lib/auth0/exception.rb +2 -0
- data/lib/auth0/mixins/httpproxy.rb +6 -1
- data/lib/auth0/version.rb +1 -1
- data/publish_rubygem.sh +10 -0
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +3 -43
- data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +26 -17
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +45 -9
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +58 -13
- data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +22 -4
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +66 -22
- data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +38 -24
- data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +15 -2
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +52 -16
- data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +12 -3
- data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +21 -5
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +15 -3
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +58 -37
- data/spec/integration/lib/auth0/auth0_client_spec.rb +1 -1
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +5 -3
- data/spec/lib/auth0/api/v2/users_by_email_spec.rb +21 -0
- data/spec/lib/auth0/client_spec.rb +0 -61
- data/spec/spec_helper.rb +23 -0
- data/spec/spec_helper_full.rb +8 -19
- data/spec/spec_helper_unit.rb +0 -9
- data/spec/support/credentials.rb +2 -0
- data/spec/support/dummy_class.rb +1 -1
- metadata +55 -107
- data/spec/integration/lib/auth0/api/v1/api_clients_spec.rb +0 -12
- data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +0 -52
- data/spec/lib/auth0/api/v1/clients_spec.rb +0 -61
- data/spec/lib/auth0/api/v1/connections_spec.rb +0 -66
- data/spec/lib/auth0/api/v1/logs_spec.rb +0 -46
- data/spec/lib/auth0/api/v1/rules_spec.rb +0 -42
- data/spec/lib/auth0/api/v1/users_spec.rb +0 -248
@@ -8,6 +8,7 @@ describe Auth0::Api::V2::Logs do
|
|
8
8
|
username = Faker::Internet.user_name
|
9
9
|
email = "#{entity_suffix}#{Faker::Internet.safe_email(username)}"
|
10
10
|
password = Faker::Internet.password
|
11
|
+
sleep 1
|
11
12
|
@user = client.create_user(username, 'email' => email,
|
12
13
|
'password' => password,
|
13
14
|
'email_verified' => false,
|
@@ -16,26 +17,33 @@ describe Auth0::Api::V2::Logs do
|
|
16
17
|
end
|
17
18
|
|
18
19
|
after(:all) do
|
20
|
+
sleep 1
|
19
21
|
client.delete_user(user['user_id'])
|
20
22
|
end
|
21
23
|
|
22
24
|
describe '.logs' do
|
23
|
-
let(:logs)
|
24
|
-
|
25
|
-
|
26
|
-
expect(find_create_user_log_by_email(user['email'])).to_not be_empty
|
27
|
-
end
|
25
|
+
let(:logs) do
|
26
|
+
sleep 1
|
27
|
+
client.logs
|
28
28
|
end
|
29
29
|
|
30
30
|
context '#filters' do
|
31
|
-
it { expect(client.logs(per_page: 1).size).to be 1 }
|
32
31
|
it do
|
32
|
+
sleep 1
|
33
|
+
expect(client.logs(per_page: 1).size).to be 1
|
34
|
+
end
|
35
|
+
it do
|
36
|
+
sleep 1
|
33
37
|
expect(
|
34
38
|
client.logs(per_page: 1, fields: [:date, :description, :type].join(','), include_fields: true).first
|
35
39
|
).to(include('date', 'description', 'type'))
|
36
40
|
end
|
37
|
-
it { expect(client.logs(per_page: 1, fields: [:date].join(',')).first).to_not include('type', 'description') }
|
38
41
|
it do
|
42
|
+
sleep 1
|
43
|
+
expect(client.logs(per_page: 1, fields: [:date].join(',')).first).to_not include('type', 'description')
|
44
|
+
end
|
45
|
+
it do
|
46
|
+
sleep 1
|
39
47
|
expect(
|
40
48
|
client.logs(per_page: 1, fields: [:date].join(','), include_fields: false).first
|
41
49
|
).to include('type', 'description')
|
@@ -43,27 +51,33 @@ describe Auth0::Api::V2::Logs do
|
|
43
51
|
end
|
44
52
|
|
45
53
|
context '#from' do
|
46
|
-
it
|
47
|
-
|
54
|
+
it do
|
55
|
+
sleep 1
|
56
|
+
expect(client.logs(from: logs.last['_id'], take: 1).size).to be 1
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
51
61
|
describe '.log' do
|
52
|
-
let(:first_log)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
let(:first_log) do
|
63
|
+
sleep 1
|
64
|
+
client.logs.first
|
65
|
+
end
|
66
|
+
let(:log) do
|
67
|
+
sleep 1
|
68
|
+
client.log(first_log['_id'])
|
69
|
+
end
|
70
|
+
it do
|
71
|
+
sleep 1
|
72
|
+
expect(log).to_not be_empty
|
73
|
+
end
|
74
|
+
it do
|
75
|
+
sleep 1
|
76
|
+
expect(log['_id']).to eq(first_log['_id'])
|
77
|
+
end
|
78
|
+
it do
|
79
|
+
sleep 1
|
80
|
+
expect(log['date']).to eq(first_log['date'])
|
67
81
|
end
|
68
82
|
end
|
69
83
|
end
|
@@ -5,15 +5,18 @@ describe Auth0::Api::V2::ResourceServers do
|
|
5
5
|
before(:all) do
|
6
6
|
@client = Auth0Client.new(v2_creds)
|
7
7
|
identifier = SecureRandom.uuid
|
8
|
+
sleep 1
|
8
9
|
@resource_server = client.create_resource_server(identifier)
|
9
10
|
end
|
10
11
|
|
11
12
|
after(:all) do
|
13
|
+
sleep 1
|
12
14
|
client.delete_resource_server(resource_server['id'])
|
13
15
|
end
|
14
16
|
|
15
17
|
describe '.resource_server' do
|
16
18
|
it do
|
19
|
+
sleep 1
|
17
20
|
expect(client.resource_server(resource_server['id'])).to(
|
18
21
|
include('identifier' => resource_server['identifier'], 'id' => resource_server['id'],
|
19
22
|
'signing_alg' => resource_server['signing_alg'],
|
@@ -29,19 +32,29 @@ describe Auth0::Api::V2::ResourceServers do
|
|
29
32
|
let(:signing_secret) { Faker::Lorem.characters(16) }
|
30
33
|
let(:token_lifetime) { rand(1000..3000) }
|
31
34
|
let!(:resource_server) do
|
35
|
+
sleep 1
|
32
36
|
client.create_resource_server(identifier, 'name' => name, 'signing_alg' => signing_alg,
|
33
37
|
'signing_secret' => signing_secret,
|
34
38
|
'token_lifetime' => token_lifetime)
|
35
39
|
end
|
36
40
|
it do
|
41
|
+
sleep 1
|
37
42
|
expect(resource_server).to include('name' => name, 'identifier' => identifier, 'signing_alg' => signing_alg,
|
38
43
|
'signing_secret' => signing_secret,
|
39
44
|
'token_lifetime' => token_lifetime)
|
45
|
+
sleep 1
|
46
|
+
expect { client.delete_resource_server(resource_server['id']) }.to_not raise_error
|
47
|
+
end
|
48
|
+
it do
|
49
|
+
sleep 1
|
50
|
+
expect { client.delete_resource_server(resource_server['id']) }.to_not raise_error
|
40
51
|
end
|
41
|
-
it { expect { client.delete_resource_server(resource_server['id']) }.to_not raise_error }
|
42
52
|
end
|
43
53
|
|
44
54
|
describe '.delete_resource_server' do
|
45
|
-
it
|
55
|
+
it do
|
56
|
+
sleep 1
|
57
|
+
expect { client.delete_resource_server(resource_server['id']) }.to_not raise_error
|
58
|
+
end
|
46
59
|
end
|
47
60
|
end
|
@@ -4,38 +4,51 @@ describe Auth0::Api::V2::Rules do
|
|
4
4
|
|
5
5
|
before(:all) do
|
6
6
|
@client = Auth0Client.new(v2_creds)
|
7
|
-
suffix = Faker::Lorem.word
|
7
|
+
suffix = "#{entity_suffix}#{Faker::Lorem.word}"
|
8
8
|
script = 'function (user, context, callback) { callback(null, user, context);}'
|
9
9
|
stage = 'login_success'
|
10
|
-
|
11
|
-
@
|
10
|
+
sleep 1
|
11
|
+
@enabled_rule = client.create_rule("Enabled Rule #{suffix}", script, nil, true, stage)
|
12
|
+
sleep 1
|
13
|
+
@disabled_rule = client.create_rule("Disabled Rule #{suffix}", script, nil, false, stage)
|
12
14
|
end
|
13
15
|
|
14
16
|
after(:all) do
|
15
17
|
rules = client.rules
|
16
18
|
rules.each do |rule|
|
19
|
+
sleep 1
|
17
20
|
client.delete_rule(rule['id'])
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
21
24
|
describe '.rules' do
|
22
|
-
let(:rules)
|
25
|
+
let(:rules) do
|
26
|
+
sleep 1
|
27
|
+
client.rules
|
28
|
+
end
|
23
29
|
|
24
|
-
it
|
30
|
+
it do
|
31
|
+
sleep 1
|
32
|
+
expect(rules.size).to be > 0
|
33
|
+
end
|
25
34
|
|
26
35
|
context '#filters' do
|
27
36
|
it do
|
28
|
-
|
37
|
+
sleep 1
|
38
|
+
expect(client.rules(enabled: true).size).to be >= 1
|
29
39
|
end
|
30
40
|
|
31
41
|
it do
|
32
|
-
|
42
|
+
sleep 1
|
43
|
+
expect(client.rules(enabled: false).size).to be >= 1
|
33
44
|
end
|
34
45
|
|
35
46
|
it do
|
47
|
+
sleep 1
|
36
48
|
expect(client.rules(enabled: true, fields: [:script, :order].join(',')).first).to(include('script', 'order'))
|
37
49
|
end
|
38
50
|
it do
|
51
|
+
sleep 1
|
39
52
|
expect(client.rules(enabled: true, fields: [:script].join(',')).first).to_not(include('order', 'name'))
|
40
53
|
end
|
41
54
|
end
|
@@ -43,20 +56,29 @@ describe Auth0::Api::V2::Rules do
|
|
43
56
|
|
44
57
|
describe '.rule' do
|
45
58
|
it do
|
59
|
+
sleep 1
|
46
60
|
expect(client.rule(enabled_rule['id'])).to(
|
47
61
|
include('stage' => enabled_rule['stage'], 'order' => enabled_rule['order'], 'script' => enabled_rule['script'])
|
48
62
|
)
|
49
63
|
end
|
50
64
|
|
51
65
|
context '#filters' do
|
52
|
-
let(:rule_include)
|
53
|
-
|
66
|
+
let(:rule_include) do
|
67
|
+
sleep 1
|
68
|
+
client.rule(enabled_rule['id'], fields: [:stage, :order, :script].join(','))
|
69
|
+
end
|
70
|
+
let(:rule_not_include) do
|
71
|
+
sleep 1
|
72
|
+
client.rule(enabled_rule['id'], fields: :stage, include_fields: false)
|
73
|
+
end
|
54
74
|
|
55
75
|
it do
|
76
|
+
sleep 1
|
56
77
|
expect(rule_include).to(include('stage', 'order', 'script'))
|
57
78
|
end
|
58
79
|
|
59
80
|
it do
|
81
|
+
sleep 1
|
60
82
|
expect(rule_not_include).to(include('order', 'script'))
|
61
83
|
expect(rule_not_include).to_not(include('stage'))
|
62
84
|
end
|
@@ -64,21 +86,35 @@ describe Auth0::Api::V2::Rules do
|
|
64
86
|
end
|
65
87
|
|
66
88
|
describe '.create_rule' do
|
67
|
-
let(:name) { Faker::Lorem.word }
|
68
|
-
let(:order) { rand(21..30) }
|
89
|
+
let(:name) { "#{Faker::Lorem.word}#{entity_suffix}" }
|
69
90
|
let(:stage) { 'login_success' }
|
70
91
|
let(:script) { 'function(test)' }
|
71
92
|
let(:enabled) { false }
|
72
|
-
let!(:rule)
|
73
|
-
|
93
|
+
let!(:rule) do
|
94
|
+
sleep 1
|
95
|
+
client.create_rule(name, script, nil, enabled, stage)
|
96
|
+
end
|
97
|
+
it do
|
98
|
+
sleep 1
|
99
|
+
expect(rule).to include('name' => name, 'stage' => stage, 'script' => script)
|
100
|
+
end
|
74
101
|
end
|
75
102
|
|
76
103
|
describe '.delete_rule' do
|
77
|
-
it
|
78
|
-
|
104
|
+
it do
|
105
|
+
sleep 1
|
106
|
+
expect { client.delete_rule(enabled_rule['id']) }.to_not raise_error
|
107
|
+
end
|
108
|
+
it do
|
109
|
+
sleep 1
|
110
|
+
expect { client.delete_rule '' }.to raise_error(Auth0::InvalidParameter)
|
111
|
+
end
|
79
112
|
end
|
80
113
|
|
81
114
|
describe '.update_rule' do
|
82
|
-
it
|
115
|
+
it do
|
116
|
+
sleep 1
|
117
|
+
expect(client.update_rule(disabled_rule['id'], enabled: true)).to(include('enabled' => true))
|
118
|
+
end
|
83
119
|
end
|
84
120
|
end
|
@@ -3,14 +3,23 @@ describe Auth0::Api::V2::Stats do
|
|
3
3
|
let(:client) { Auth0Client.new(v2_creds) }
|
4
4
|
|
5
5
|
describe '.active_users' do
|
6
|
-
it
|
6
|
+
it do
|
7
|
+
sleep 1
|
8
|
+
expect(Integer(client.active_users)).to be >= 0
|
9
|
+
end
|
7
10
|
end
|
8
11
|
|
9
12
|
# rubocop:disable Date
|
10
13
|
describe '.daily_stats' do
|
11
14
|
let(:from) { Date.today.prev_day.strftime('%Y%m%d') }
|
12
15
|
let(:to) { Date.today.strftime('%Y%m%d') }
|
13
|
-
let(:daily_stats)
|
14
|
-
|
16
|
+
let(:daily_stats) do
|
17
|
+
sleep 1
|
18
|
+
client.daily_stats(from, to)
|
19
|
+
end
|
20
|
+
it do
|
21
|
+
sleep 1
|
22
|
+
expect(daily_stats.size).to be > 0
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
@@ -16,15 +16,28 @@ describe Auth0::Api::V2::Tenants do
|
|
16
16
|
'support_url' => 'https://mycompany.org/support'
|
17
17
|
}
|
18
18
|
|
19
|
+
sleep 1
|
19
20
|
client.update_tenant_settings(body)
|
20
21
|
end
|
21
22
|
|
22
23
|
describe '.get_tenant_settings' do
|
23
|
-
it
|
24
|
+
it do
|
25
|
+
sleep 1
|
26
|
+
expect(client.get_tenant_settings).to include(body)
|
27
|
+
end
|
24
28
|
|
25
|
-
let(:tenant_setting_fields)
|
26
|
-
|
27
|
-
|
29
|
+
let(:tenant_setting_fields) do
|
30
|
+
sleep 1
|
31
|
+
client.get_tenant_settings(fields: 'picture_url')
|
32
|
+
end
|
33
|
+
it do
|
34
|
+
sleep 1
|
35
|
+
expect(tenant_setting_fields).to_not include('friendly_name' => 'My Company')
|
36
|
+
end
|
37
|
+
it do
|
38
|
+
sleep 1
|
39
|
+
expect(tenant_setting_fields).to include('picture_url' => 'https://mycompany.org/logo.png')
|
40
|
+
end
|
28
41
|
end
|
29
42
|
|
30
43
|
describe '.update_tenant_settings' do
|
@@ -32,6 +45,9 @@ describe Auth0::Api::V2::Tenants do
|
|
32
45
|
let(:body_tenant) do
|
33
46
|
{ 'friendly_name' => tenant_name }
|
34
47
|
end
|
35
|
-
it
|
48
|
+
it do
|
49
|
+
sleep 1
|
50
|
+
expect(client.update_tenant_settings(body_tenant)['friendly_name']).to include(tenant_name)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
@@ -7,6 +7,7 @@ describe Auth0::Api::V2::Tickets do
|
|
7
7
|
username = Faker::Internet.user_name
|
8
8
|
email = "#{entity_suffix}#{Faker::Internet.safe_email(username)}"
|
9
9
|
password = Faker::Internet.password
|
10
|
+
sleep 1
|
10
11
|
@user = client.create_user(username, 'email' => email,
|
11
12
|
'password' => password,
|
12
13
|
'email_verified' => false,
|
@@ -15,19 +16,30 @@ describe Auth0::Api::V2::Tickets do
|
|
15
16
|
end
|
16
17
|
|
17
18
|
after(:all) do
|
19
|
+
sleep 1
|
18
20
|
client.delete_user(user['user_id'])
|
19
21
|
end
|
20
22
|
|
21
23
|
describe '.post_email_verification' do
|
22
|
-
let(:email_verification)
|
23
|
-
|
24
|
+
let(:email_verification) do
|
25
|
+
sleep 1
|
26
|
+
client.post_email_verification(user['user_id'], result_url: 'http://myapp.com/callback')
|
27
|
+
end
|
28
|
+
it do
|
29
|
+
sleep 1
|
30
|
+
expect(email_verification).to include('ticket')
|
31
|
+
end
|
24
32
|
end
|
25
33
|
|
26
34
|
describe '.post_password_change' do
|
27
35
|
let(:password_change) do
|
36
|
+
sleep 1
|
28
37
|
client.post_password_change(new_password: 'secret', user_id: user['user_id'],
|
29
38
|
result_url: 'http://myapp.com/callback')
|
30
39
|
end
|
31
|
-
it
|
40
|
+
it do
|
41
|
+
sleep 1
|
42
|
+
expect(password_change).to include('ticket')
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
@@ -4,7 +4,8 @@ describe Auth0::Api::V2::Users do
|
|
4
4
|
let(:username) { Faker::Internet.user_name }
|
5
5
|
let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
|
6
6
|
let(:password) { Faker::Internet.password }
|
7
|
-
let
|
7
|
+
let(:user) do
|
8
|
+
sleep 1
|
8
9
|
client.create_user(username, 'email' => email,
|
9
10
|
'password' => password,
|
10
11
|
'email_verified' => false,
|
@@ -13,19 +14,33 @@ describe Auth0::Api::V2::Users do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
describe '.users' do
|
16
|
-
let(:users)
|
17
|
+
let(:users) do
|
18
|
+
sleep 1
|
19
|
+
client.users
|
20
|
+
end
|
17
21
|
|
18
|
-
it
|
22
|
+
it do
|
23
|
+
sleep 1
|
24
|
+
expect(users.size).to be > 0
|
25
|
+
end
|
19
26
|
|
20
27
|
context '#filters' do
|
21
|
-
it { expect(client.users(per_page: 1).size).to be 1 }
|
22
28
|
it do
|
29
|
+
sleep 1
|
30
|
+
expect(client.users(per_page: 1).size).to be 1
|
31
|
+
end
|
32
|
+
it do
|
33
|
+
sleep 1
|
23
34
|
expect(
|
24
35
|
client.users(per_page: 1, fields: [:picture, :email, :user_id].join(','), include_fields: true).first
|
25
36
|
).to(include('email', 'user_id', 'picture'))
|
26
37
|
end
|
27
|
-
it { expect(client.users(per_page: 1, fields: [:email].join(',')).first).to_not include('user_id', 'picture') }
|
28
38
|
it do
|
39
|
+
sleep 1
|
40
|
+
expect(client.users(per_page: 1, fields: [:email].join(',')).first).to_not include('user_id', 'picture')
|
41
|
+
end
|
42
|
+
it do
|
43
|
+
sleep 1
|
29
44
|
expect(
|
30
45
|
client.users(per_page: 1, fields: [:email].join(','), include_fields: false).first
|
31
46
|
).to include('user_id', 'picture')
|
@@ -34,15 +49,23 @@ describe Auth0::Api::V2::Users do
|
|
34
49
|
end
|
35
50
|
|
36
51
|
describe '.user' do
|
37
|
-
let(:subject)
|
52
|
+
let(:subject) do
|
53
|
+
sleep 1
|
54
|
+
client.user(user['user_id'])
|
55
|
+
end
|
38
56
|
|
39
|
-
it { should include('email' => email, 'name' => username) }
|
40
57
|
it do
|
58
|
+
sleep 1
|
59
|
+
should include('email' => email, 'name' => username)
|
60
|
+
end
|
61
|
+
it do
|
62
|
+
sleep 1
|
41
63
|
expect(
|
42
64
|
client.user(user['user_id'], fields: [:picture, :email, :user_id].join(','), include_fields: true)
|
43
65
|
).to(include('email', 'user_id', 'picture'))
|
44
66
|
end
|
45
67
|
it do
|
68
|
+
sleep 1
|
46
69
|
expect(
|
47
70
|
client.user(user['user_id'], fields: [:picture, :email, :user_id].join(','), include_fields: false)
|
48
71
|
).not_to(include('email', 'user_id', 'picture'))
|
@@ -50,28 +73,47 @@ describe Auth0::Api::V2::Users do
|
|
50
73
|
|
51
74
|
context '#filters' do
|
52
75
|
it do
|
76
|
+
sleep 1
|
53
77
|
expect(client.user(user['user_id'], fields: [:picture, :email, :user_id].join(','))).to(
|
54
78
|
include('email', 'user_id', 'picture')
|
55
79
|
)
|
56
80
|
end
|
57
|
-
it
|
81
|
+
it do
|
82
|
+
sleep 1
|
83
|
+
expect(client.user(user['user_id'], fields: [:email].join(','))).to_not include('user_id', 'picture')
|
84
|
+
end
|
58
85
|
end
|
59
86
|
end
|
60
87
|
|
61
88
|
describe '.create_user' do
|
62
89
|
let(:subject) { user }
|
63
90
|
|
64
|
-
it
|
65
|
-
|
91
|
+
it do
|
92
|
+
sleep 1
|
93
|
+
should include('user_id', 'identities')
|
94
|
+
end
|
95
|
+
it do
|
96
|
+
sleep 1
|
97
|
+
expect(client.patch_user(user['user_id'], 'email_verified' => true)).to include('email_verified' => true)
|
98
|
+
end
|
66
99
|
end
|
67
100
|
|
68
101
|
describe '.delete_user' do
|
69
|
-
it
|
70
|
-
|
102
|
+
it do
|
103
|
+
sleep 1
|
104
|
+
expect { client.delete_user user['user_id'] }.to_not raise_error
|
105
|
+
end
|
106
|
+
it do
|
107
|
+
sleep 1
|
108
|
+
expect { client.delete_user '' }.to raise_error(Auth0::MissingUserId)
|
109
|
+
end
|
71
110
|
end
|
72
111
|
|
73
112
|
describe '.patch_user' do
|
74
|
-
it
|
113
|
+
it do
|
114
|
+
sleep 1
|
115
|
+
expect(client.patch_user(user['user_id'], 'email_verified' => true)).to(include('email_verified' => true))
|
116
|
+
end
|
75
117
|
let(:body_path) do
|
76
118
|
{
|
77
119
|
'user_metadata' => {
|
@@ -80,6 +122,7 @@ describe Auth0::Api::V2::Users do
|
|
80
122
|
}
|
81
123
|
end
|
82
124
|
it do
|
125
|
+
sleep 1
|
83
126
|
expect(
|
84
127
|
client.patch_user(user['user_id'], body_path)
|
85
128
|
).to(include('user_metadata' => { 'addresses' => { 'home_address' => '742 Evergreen Terrace' } }))
|
@@ -89,6 +132,7 @@ describe Auth0::Api::V2::Users do
|
|
89
132
|
describe '.link_user_account and .unlink_users_account' do
|
90
133
|
let(:email_link) { "#{entity_suffix}#{Faker::Internet.safe_email(Faker::Internet.user_name)}" }
|
91
134
|
let!(:link_user) do
|
135
|
+
sleep 1
|
92
136
|
client.create_user(username, 'email' => email_link,
|
93
137
|
'password' => Faker::Internet.password,
|
94
138
|
'email_verified' => false,
|
@@ -97,6 +141,7 @@ describe Auth0::Api::V2::Users do
|
|
97
141
|
end
|
98
142
|
let(:email_primary) { "#{entity_suffix}#{Faker::Internet.safe_email(Faker::Internet.user_name)}" }
|
99
143
|
let!(:primary_user) do
|
144
|
+
sleep 1
|
100
145
|
client.create_user(username, 'email' => email_primary,
|
101
146
|
'password' => Faker::Internet.password,
|
102
147
|
'email_verified' => false,
|
@@ -120,28 +165,4 @@ describe Auth0::Api::V2::Users do
|
|
120
165
|
end
|
121
166
|
end
|
122
167
|
|
123
|
-
describe '.user_logs' do
|
124
|
-
it 'is expected that the user logs contain a success signup log entry' do
|
125
|
-
wait 30 do
|
126
|
-
user_logs = client.user_logs(user['user_id'])
|
127
|
-
expect(user_logs.size).to be > 0
|
128
|
-
expect(find_success_signup_log_by_email(user['email'], user_logs)).to_not be_empty
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
context '#filters' do
|
133
|
-
it do
|
134
|
-
wait 30 do
|
135
|
-
expect(client.user_logs(user['user_id'], per_page: 1).size).to be 1
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def find_success_signup_log_by_email(email, logs)
|
142
|
-
logs.find do |log|
|
143
|
-
log['type'] == 'ss' &&
|
144
|
-
log['details']['body']['email'] == email
|
145
|
-
end
|
146
|
-
end
|
147
168
|
end
|