auth0 5.6.1 → 5.8.1
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 +16 -2
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/semgrep.yml +28 -0
- data/.gitignore +0 -1
- data/CHANGELOG.md +43 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +241 -0
- data/README.md +1 -1
- data/auth0.gemspec +1 -1
- data/lib/auth0/api/authentication_endpoints.rb +1 -1
- data/lib/auth0/api/v2/attack_protection.rb +79 -0
- data/lib/auth0/api/v2/device_credentials.rb +8 -3
- data/lib/auth0/api/v2/organizations.rb +2 -2
- data/lib/auth0/api/v2.rb +2 -0
- data/lib/auth0/mixins/validation.rb +4 -4
- data/lib/auth0/version.rb +1 -1
- data/spec/lib/auth0/api/v2/actions_spec.rb +13 -13
- data/spec/lib/auth0/api/v2/attack_protection_spec.rb +132 -0
- data/spec/lib/auth0/api/v2/blacklists_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/branding_spec.rb +4 -3
- data/spec/lib/auth0/api/v2/client_grants_spec.rb +8 -8
- data/spec/lib/auth0/api/v2/clients_spec.rb +12 -12
- data/spec/lib/auth0/api/v2/connections_spec.rb +10 -10
- data/spec/lib/auth0/api/v2/device_credentials_spec.rb +39 -10
- data/spec/lib/auth0/api/v2/emails_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/grants_spec.rb +10 -10
- data/spec/lib/auth0/api/v2/jobs_spec.rb +18 -17
- data/spec/lib/auth0/api/v2/log_streams_spec.rb +3 -3
- data/spec/lib/auth0/api/v2/logs_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/organizations_spec.rb +14 -14
- data/spec/lib/auth0/api/v2/resource_servers_spec.rb +5 -5
- data/spec/lib/auth0/api/v2/roles_spec.rb +22 -22
- data/spec/lib/auth0/api/v2/rules_spec.rb +7 -7
- data/spec/lib/auth0/api/v2/stats_spec.rb +1 -1
- data/spec/lib/auth0/api/v2/tenants_spec.rb +1 -1
- data/spec/lib/auth0/api/v2/tickets_spec.rb +14 -14
- data/spec/lib/auth0/api/v2/user_blocks_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/users_by_email_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/users_spec.rb +23 -23
- data/spec/lib/auth0/mixins/validation_spec.rb +16 -2
- metadata +11 -5
@@ -25,24 +25,24 @@ describe Auth0::Api::V2::Jobs do
|
|
25
25
|
it { expect(@instance).to respond_to(:import_users) }
|
26
26
|
it 'expect client to send post to /api/v2/jobs/users-imports' do
|
27
27
|
expect(@instance).to receive(:post_file).with(
|
28
|
-
'/api/v2/jobs/users-imports',
|
28
|
+
'/api/v2/jobs/users-imports', {
|
29
29
|
users: 'file',
|
30
30
|
connection_id: 'connnection_id',
|
31
31
|
upsert: false,
|
32
32
|
external_id: nil,
|
33
33
|
send_completion_email: true
|
34
|
-
)
|
34
|
+
})
|
35
35
|
expect { @instance.import_users('file', 'connnection_id') }.not_to raise_error
|
36
36
|
end
|
37
37
|
it 'expect client to send post to /api/v2/jobs/users-imports with options' do
|
38
38
|
expect(@instance).to receive(:post_file).with(
|
39
|
-
'/api/v2/jobs/users-imports',
|
39
|
+
'/api/v2/jobs/users-imports', {
|
40
40
|
users: 'file',
|
41
41
|
connection_id: 'connnection_id',
|
42
42
|
upsert: true,
|
43
43
|
external_id: 'external_1',
|
44
44
|
send_completion_email: false
|
45
|
-
)
|
45
|
+
})
|
46
46
|
expect do
|
47
47
|
@instance.import_users(
|
48
48
|
'file',
|
@@ -61,12 +61,12 @@ describe Auth0::Api::V2::Jobs do
|
|
61
61
|
it { expect { @instance.export_users }.not_to raise_error }
|
62
62
|
it 'sends post to /api/v2/jobs/users-exports with correct params' do
|
63
63
|
expect(@instance).to receive(:post).with(
|
64
|
-
'/api/v2/jobs/users-exports',
|
64
|
+
'/api/v2/jobs/users-exports', {
|
65
65
|
fields: [{ name: 'author' }],
|
66
66
|
connection_id: 'test-connection',
|
67
67
|
format: 'csv',
|
68
68
|
limit: 10
|
69
|
-
)
|
69
|
+
})
|
70
70
|
@instance.export_users(
|
71
71
|
fields: ['author'],
|
72
72
|
connection_id: 'test-connection',
|
@@ -83,9 +83,9 @@ describe Auth0::Api::V2::Jobs do
|
|
83
83
|
|
84
84
|
it 'should post to the jobs email verification endpoint' do
|
85
85
|
expect(@instance).to receive(:post).with(
|
86
|
-
'/api/v2/jobs/verification-email',
|
86
|
+
'/api/v2/jobs/verification-email', {
|
87
87
|
user_id: 'test_user_id'
|
88
|
-
)
|
88
|
+
})
|
89
89
|
expect do
|
90
90
|
@instance.send_verification_email('test_user_id')
|
91
91
|
end.not_to raise_error
|
@@ -93,21 +93,22 @@ describe Auth0::Api::V2::Jobs do
|
|
93
93
|
|
94
94
|
it 'should post to the jobs email verification endpoint with a client_id' do
|
95
95
|
expect(@instance).to receive(:post).with(
|
96
|
-
'/api/v2/jobs/verification-email',
|
96
|
+
'/api/v2/jobs/verification-email', {
|
97
97
|
user_id: 'test_user_id',
|
98
98
|
client_id: 'test_client_id'
|
99
|
-
)
|
99
|
+
})
|
100
100
|
expect do
|
101
101
|
@instance.send_verification_email('test_user_id', 'test_client_id')
|
102
102
|
end.not_to raise_error
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'expect client to accept hash identity' do
|
106
|
-
expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email',
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email', {
|
107
|
+
user_id: 'user_id',
|
108
|
+
identity: {
|
109
|
+
provider: "auth0",
|
110
|
+
user_id: "user_id"
|
111
|
+
}})
|
111
112
|
expect {
|
112
113
|
@instance.send_verification_email('user_id', identity: { provider: "auth0", user_id: "user_id"})
|
113
114
|
}.not_to raise_error
|
@@ -120,10 +121,10 @@ describe Auth0::Api::V2::Jobs do
|
|
120
121
|
end
|
121
122
|
|
122
123
|
it 'expect client to accept organization_id' do
|
123
|
-
expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email',
|
124
|
+
expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email', {
|
124
125
|
user_id: 'user_id',
|
125
126
|
organization_id: 'org_id'
|
126
|
-
)
|
127
|
+
})
|
127
128
|
|
128
129
|
expect {
|
129
130
|
@instance.send_verification_email('user_id', organization_id: 'org_id')
|
@@ -33,7 +33,7 @@ describe Auth0::Api::V2::LogStreams do
|
|
33
33
|
it { expect(@instance).to respond_to(:create_log_stream) }
|
34
34
|
it 'is expected to call post /api/v2/log-streams' do
|
35
35
|
expect(@instance).to receive(:post).with(
|
36
|
-
'/api/v2/log-streams',
|
36
|
+
'/api/v2/log-streams', {
|
37
37
|
name: 'test',
|
38
38
|
type: 'https',
|
39
39
|
sink: {
|
@@ -42,7 +42,7 @@ describe Auth0::Api::V2::LogStreams do
|
|
42
42
|
httpContentFormat: "JSONLINES",
|
43
43
|
httpAuthorization: "string"
|
44
44
|
}
|
45
|
-
)
|
45
|
+
})
|
46
46
|
|
47
47
|
@instance.create_log_stream('test', 'https',
|
48
48
|
httpEndpoint: "https://mycompany.com",
|
@@ -75,7 +75,7 @@ describe Auth0::Api::V2::LogStreams do
|
|
75
75
|
context '.patch_log_stream' do
|
76
76
|
it { expect(@instance).to respond_to(:patch_log_stream) }
|
77
77
|
it 'is expected to send patch to /api/v2/log_streams/test' do
|
78
|
-
expect(@instance).to receive(:patch).with('/api/v2/log-streams/test', status: 'paused')
|
78
|
+
expect(@instance).to receive(:patch).with('/api/v2/log-streams/test', { status: 'paused' })
|
79
79
|
expect { @instance.patch_log_stream('test', 'paused') }.not_to raise_error
|
80
80
|
end
|
81
81
|
it { expect { @instance.patch_log_stream('', nil) }.to raise_error 'Must specify a log stream id' }
|
@@ -11,7 +11,7 @@ describe Auth0::Api::V2::Logs do
|
|
11
11
|
it { expect(@instance).to respond_to(:get_logs) }
|
12
12
|
it 'is expected to call /api/v2/logs' do
|
13
13
|
expect(@instance).to receive(:get).with(
|
14
|
-
'/api/v2/logs',
|
14
|
+
'/api/v2/logs', {
|
15
15
|
q: nil,
|
16
16
|
page: nil,
|
17
17
|
per_page: nil,
|
@@ -21,7 +21,7 @@ describe Auth0::Api::V2::Logs do
|
|
21
21
|
include_totals: nil,
|
22
22
|
from: nil,
|
23
23
|
take: nil
|
24
|
-
)
|
24
|
+
})
|
25
25
|
expect { @instance.logs }.not_to raise_error
|
26
26
|
end
|
27
27
|
it 'is expect to rise an error when take is higher than 100' do
|
@@ -17,25 +17,25 @@ describe Auth0::Api::V2::Organizations do
|
|
17
17
|
|
18
18
|
it 'is expected to get /api/v2/organizations' do
|
19
19
|
expect(@instance).to receive(:get).with(
|
20
|
-
'/api/v2/organizations',
|
20
|
+
'/api/v2/organizations', {
|
21
21
|
per_page: nil,
|
22
22
|
page: nil,
|
23
23
|
from: nil,
|
24
24
|
take: nil,
|
25
25
|
include_totals: nil
|
26
|
-
)
|
26
|
+
})
|
27
27
|
expect { @instance.organizations }.not_to raise_error
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'is expected to get /api/v2/organizations with custom parameters' do
|
31
31
|
expect(@instance).to receive(:get).with(
|
32
|
-
'/api/v2/organizations',
|
32
|
+
'/api/v2/organizations', {
|
33
33
|
per_page: 10,
|
34
34
|
page: 1,
|
35
35
|
from: 'org_id',
|
36
36
|
take: 50,
|
37
37
|
include_totals: true
|
38
|
-
)
|
38
|
+
})
|
39
39
|
expect do
|
40
40
|
@instance.organizations(
|
41
41
|
per_page: 10,
|
@@ -72,9 +72,9 @@ describe Auth0::Api::V2::Organizations do
|
|
72
72
|
|
73
73
|
it 'is expected to post to /api/v2/organizations' do
|
74
74
|
expect(@instance).to receive(:post).with(
|
75
|
-
'/api/v2/organizations',
|
75
|
+
'/api/v2/organizations', {
|
76
76
|
name: 'test_org'
|
77
|
-
)
|
77
|
+
})
|
78
78
|
expect do
|
79
79
|
@instance.create_organization(
|
80
80
|
name: 'test_org'
|
@@ -130,9 +130,9 @@ describe Auth0::Api::V2::Organizations do
|
|
130
130
|
|
131
131
|
it 'is expected to patch /api/v2/organizations/org_id' do
|
132
132
|
expect(@instance).to receive(:patch).with(
|
133
|
-
'/api/v2/organizations/org_id',
|
133
|
+
'/api/v2/organizations/org_id', {
|
134
134
|
name: 'name'
|
135
|
-
)
|
135
|
+
})
|
136
136
|
@instance.patch_organization(
|
137
137
|
'org_id',
|
138
138
|
name: 'name'
|
@@ -446,13 +446,13 @@ describe Auth0::Api::V2::Organizations do
|
|
446
446
|
|
447
447
|
it 'is expected to get members for an org' do
|
448
448
|
expect(@instance).to receive(:get).with(
|
449
|
-
'/api/v2/organizations/org_id/members',
|
449
|
+
'/api/v2/organizations/org_id/members', {
|
450
450
|
per_page: nil,
|
451
451
|
page: nil,
|
452
452
|
from: nil,
|
453
453
|
take: nil,
|
454
454
|
include_totals: nil
|
455
|
-
)
|
455
|
+
})
|
456
456
|
expect do
|
457
457
|
@instance.get_organizations_members('org_id')
|
458
458
|
end.not_to raise_error
|
@@ -460,13 +460,13 @@ describe Auth0::Api::V2::Organizations do
|
|
460
460
|
|
461
461
|
it 'is expected to get /api/v2/organizations with custom parameters' do
|
462
462
|
expect(@instance).to receive(:get).with(
|
463
|
-
'/api/v2/organizations/org_id/members',
|
463
|
+
'/api/v2/organizations/org_id/members', {
|
464
464
|
per_page: 10,
|
465
465
|
page: 1,
|
466
466
|
from: 'org_id',
|
467
467
|
take: 50,
|
468
468
|
include_totals: true
|
469
|
-
)
|
469
|
+
})
|
470
470
|
expect do
|
471
471
|
@instance.get_organizations_members(
|
472
472
|
'org_id',
|
@@ -514,7 +514,7 @@ describe Auth0::Api::V2::Organizations do
|
|
514
514
|
end
|
515
515
|
|
516
516
|
it 'is expected to delete /api/v2/organizations/org_id/members' do
|
517
|
-
expect(@instance).to receive(:
|
517
|
+
expect(@instance).to receive(:delete_with_body).with(
|
518
518
|
'/api/v2/organizations/org_id/members', {
|
519
519
|
members: ['123', '456']
|
520
520
|
}
|
@@ -595,7 +595,7 @@ describe Auth0::Api::V2::Organizations do
|
|
595
595
|
end
|
596
596
|
|
597
597
|
it 'is expected to delete /api/v2/organizations/org_id/members/user_id/roles' do
|
598
|
-
expect(@instance).to receive(:
|
598
|
+
expect(@instance).to receive(:delete_with_body).with(
|
599
599
|
'/api/v2/organizations/org_id/members/user_id/roles', {
|
600
600
|
roles: ['123', '456']
|
601
601
|
}
|
@@ -12,10 +12,10 @@ describe Auth0::Api::V2::ResourceServers do
|
|
12
12
|
it { expect(@instance).to respond_to(:get_resource_servers) }
|
13
13
|
it 'is expected to call get /api/v2/resource-servers' do
|
14
14
|
expect(@instance).to receive(:get).with(
|
15
|
-
'/api/v2/resource-servers',
|
15
|
+
'/api/v2/resource-servers', {
|
16
16
|
page: nil,
|
17
17
|
per_page: nil,
|
18
|
-
)
|
18
|
+
})
|
19
19
|
expect { @instance.resource_servers }.not_to raise_error
|
20
20
|
end
|
21
21
|
end
|
@@ -35,14 +35,14 @@ describe Auth0::Api::V2::ResourceServers do
|
|
35
35
|
it { expect(@instance).to respond_to(:create_resource_server) }
|
36
36
|
it 'is expected to call post /api/v2/resource-servers' do
|
37
37
|
expect(@instance).to receive(:post).with(
|
38
|
-
'/api/v2/resource-servers',
|
38
|
+
'/api/v2/resource-servers', {
|
39
39
|
identifier: 'test',
|
40
40
|
name: 'name',
|
41
41
|
signing_alg: 'signing_alg',
|
42
42
|
signing_secret: 'signing_secret',
|
43
43
|
token_lifetime: 'token_lifetime',
|
44
44
|
scopes: 'scopes'
|
45
|
-
)
|
45
|
+
})
|
46
46
|
|
47
47
|
@instance.create_resource_server('test', name: 'name',
|
48
48
|
signing_alg: 'signing_alg',
|
@@ -77,7 +77,7 @@ describe Auth0::Api::V2::ResourceServers do
|
|
77
77
|
context '.patch_resource_server' do
|
78
78
|
it { expect(@instance).to respond_to(:patch_resource_server) }
|
79
79
|
it 'is expected to send patch to /api/v2/resource_servers/1' do
|
80
|
-
expect(@instance).to receive(:patch).with('/api/v2/resource-servers/1', fields: 'fields')
|
80
|
+
expect(@instance).to receive(:patch).with('/api/v2/resource-servers/1', { fields: 'fields' })
|
81
81
|
expect { @instance.patch_resource_server('1', fields: 'fields') }.not_to raise_error
|
82
82
|
end
|
83
83
|
it { expect { @instance.patch_resource_server('', nil) }.to raise_error Auth0::InvalidParameter }
|
@@ -17,23 +17,23 @@ describe Auth0::Api::V2::Roles do
|
|
17
17
|
|
18
18
|
it 'is expected to get Roles with default parameters' do
|
19
19
|
expect(@instance).to receive(:get).with(
|
20
|
-
'/api/v2/roles',
|
20
|
+
'/api/v2/roles', {
|
21
21
|
per_page: nil,
|
22
22
|
page: nil,
|
23
23
|
include_totals: nil,
|
24
24
|
name_filter: nil
|
25
|
-
)
|
25
|
+
})
|
26
26
|
expect { @instance.get_roles }.not_to raise_error
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'is expected to get Roles with custom parameters' do
|
30
30
|
expect(@instance).to receive(:get).with(
|
31
|
-
'/api/v2/roles',
|
31
|
+
'/api/v2/roles', {
|
32
32
|
per_page: 10,
|
33
33
|
page: 3,
|
34
34
|
include_totals: true,
|
35
35
|
name_filter: 'test'
|
36
|
-
)
|
36
|
+
})
|
37
37
|
expect do
|
38
38
|
@instance.get_roles(per_page: 10, page: 3, include_totals: true, name_filter: 'test')
|
39
39
|
end.not_to raise_error
|
@@ -76,10 +76,10 @@ describe Auth0::Api::V2::Roles do
|
|
76
76
|
|
77
77
|
it 'is expected to post a new Role' do
|
78
78
|
expect(@instance).to receive(:post).with(
|
79
|
-
'/api/v2/roles',
|
79
|
+
'/api/v2/roles', {
|
80
80
|
name: 'ROLE_NAME',
|
81
81
|
description: 'ROLE_DESCRIPTION'
|
82
|
-
)
|
82
|
+
})
|
83
83
|
expect do
|
84
84
|
@instance.create_role(
|
85
85
|
'ROLE_NAME',
|
@@ -103,10 +103,10 @@ describe Auth0::Api::V2::Roles do
|
|
103
103
|
|
104
104
|
it 'is expected to post an updated Role' do
|
105
105
|
expect(@instance).to receive(:patch).with(
|
106
|
-
'/api/v2/roles/ROLE_ID',
|
106
|
+
'/api/v2/roles/ROLE_ID', {
|
107
107
|
name: 'ROLE_NAME',
|
108
108
|
description: 'ROLE_DESCRIPTION'
|
109
|
-
)
|
109
|
+
})
|
110
110
|
expect do
|
111
111
|
@instance.update_role(
|
112
112
|
'ROLE_ID',
|
@@ -149,25 +149,25 @@ describe Auth0::Api::V2::Roles do
|
|
149
149
|
|
150
150
|
it 'is expected to get Users for a Role with default parameters' do
|
151
151
|
expect(@instance).to receive(:get).with(
|
152
|
-
'/api/v2/roles/ROLE_ID/users',
|
152
|
+
'/api/v2/roles/ROLE_ID/users', {
|
153
153
|
per_page: nil,
|
154
154
|
page: nil,
|
155
155
|
from: nil,
|
156
156
|
take: nil,
|
157
157
|
include_totals: nil
|
158
|
-
)
|
158
|
+
})
|
159
159
|
expect { @instance.get_role_users('ROLE_ID') }.not_to raise_error
|
160
160
|
end
|
161
161
|
|
162
162
|
it 'is expected to get Users for a Role with custom parameters' do
|
163
163
|
expect(@instance).to receive(:get).with(
|
164
|
-
'/api/v2/roles/ROLE_ID/users',
|
164
|
+
'/api/v2/roles/ROLE_ID/users', {
|
165
165
|
per_page: 30,
|
166
166
|
page: 4,
|
167
167
|
from: 'org_id',
|
168
168
|
take: 50,
|
169
169
|
include_totals: true
|
170
|
-
)
|
170
|
+
})
|
171
171
|
expect do
|
172
172
|
@instance.get_role_users('ROLE_ID', per_page: 30, page: 4, from: 'org_id', take: 50, include_totals: true)
|
173
173
|
end.not_to raise_error
|
@@ -202,9 +202,9 @@ describe Auth0::Api::V2::Roles do
|
|
202
202
|
|
203
203
|
it 'is expected to add Users to a Role' do
|
204
204
|
expect(@instance).to receive(:post).with(
|
205
|
-
'/api/v2/roles/ROLE_ID/users',
|
205
|
+
'/api/v2/roles/ROLE_ID/users', {
|
206
206
|
users: %w[test|user-01 test|user-02]
|
207
|
-
)
|
207
|
+
})
|
208
208
|
expect do
|
209
209
|
@instance.add_role_users('ROLE_ID', %w[test|user-01 test|user-02])
|
210
210
|
end.not_to raise_error
|
@@ -225,21 +225,21 @@ describe Auth0::Api::V2::Roles do
|
|
225
225
|
|
226
226
|
it 'is expected to get Roles with default parameters' do
|
227
227
|
expect(@instance).to receive(:get).with(
|
228
|
-
'/api/v2/roles/ROLE_ID/permissions',
|
228
|
+
'/api/v2/roles/ROLE_ID/permissions', {
|
229
229
|
per_page: nil,
|
230
230
|
page: nil,
|
231
231
|
include_totals: nil
|
232
|
-
)
|
232
|
+
})
|
233
233
|
expect { @instance.get_role_permissions('ROLE_ID') }.not_to raise_error
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'is expected to get Roles with custom parameters' do
|
237
237
|
expect(@instance).to receive(:get).with(
|
238
|
-
'/api/v2/roles/ROLE_ID/permissions',
|
238
|
+
'/api/v2/roles/ROLE_ID/permissions', {
|
239
239
|
per_page: 15,
|
240
240
|
page: 5,
|
241
241
|
include_totals: true
|
242
|
-
)
|
242
|
+
})
|
243
243
|
expect do
|
244
244
|
@instance.get_role_permissions('ROLE_ID', per_page: 15, page: 5, include_totals: true)
|
245
245
|
end.not_to raise_error
|
@@ -281,7 +281,7 @@ describe Auth0::Api::V2::Roles do
|
|
281
281
|
|
282
282
|
it 'is expected to add permissions to a Role' do
|
283
283
|
expect(@instance).to receive(:post).with(
|
284
|
-
'/api/v2/roles/ROLE_ID/permissions',
|
284
|
+
'/api/v2/roles/ROLE_ID/permissions', {
|
285
285
|
permissions: [
|
286
286
|
{
|
287
287
|
permission_name: 'permission-name-1',
|
@@ -292,7 +292,7 @@ describe Auth0::Api::V2::Roles do
|
|
292
292
|
resource_server_identifier: 'server-id-2'
|
293
293
|
}
|
294
294
|
]
|
295
|
-
)
|
295
|
+
})
|
296
296
|
expect do
|
297
297
|
@instance.add_role_permissions(
|
298
298
|
'ROLE_ID',
|
@@ -340,7 +340,7 @@ describe Auth0::Api::V2::Roles do
|
|
340
340
|
|
341
341
|
it 'is expected to remove permissions from a Role' do
|
342
342
|
expect(@instance).to receive(:delete_with_body).with(
|
343
|
-
'/api/v2/roles/ROLE_ID/permissions',
|
343
|
+
'/api/v2/roles/ROLE_ID/permissions', {
|
344
344
|
permissions: [
|
345
345
|
{
|
346
346
|
permission_name: 'permission-name-3',
|
@@ -351,7 +351,7 @@ describe Auth0::Api::V2::Roles do
|
|
351
351
|
resource_server_identifier: 'server-id-4'
|
352
352
|
}
|
353
353
|
]
|
354
|
-
)
|
354
|
+
})
|
355
355
|
expect do
|
356
356
|
@instance.remove_role_permissions(
|
357
357
|
'ROLE_ID',
|
@@ -12,27 +12,27 @@ describe Auth0::Api::V2::Rules do
|
|
12
12
|
|
13
13
|
it 'is expected to call get /api/v2/rules' do
|
14
14
|
expect(@instance).to receive(:get).with(
|
15
|
-
'/api/v2/rules',
|
15
|
+
'/api/v2/rules', {
|
16
16
|
enabled: nil,
|
17
17
|
fields: nil,
|
18
18
|
include_fields: nil,
|
19
19
|
stage: nil,
|
20
20
|
page: nil,
|
21
21
|
per_page: nil
|
22
|
-
)
|
22
|
+
})
|
23
23
|
expect { @instance.rules }.not_to raise_error
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'is expected to call get /api/v2/rules with pagination' do
|
27
27
|
expect(@instance).to receive(:get).with(
|
28
|
-
'/api/v2/rules',
|
28
|
+
'/api/v2/rules', {
|
29
29
|
enabled: nil,
|
30
30
|
fields: nil,
|
31
31
|
include_fields: nil,
|
32
32
|
stage: nil,
|
33
33
|
page: 1,
|
34
34
|
per_page: 2
|
35
|
-
)
|
35
|
+
})
|
36
36
|
expect {
|
37
37
|
@instance.rules(page: 1, per_page: 2)
|
38
38
|
}.not_to raise_error
|
@@ -43,7 +43,7 @@ describe Auth0::Api::V2::Rules do
|
|
43
43
|
it { expect(@instance).to respond_to(:rule) }
|
44
44
|
it 'is expected to call get /api/v2/rules/test' do
|
45
45
|
expect(@instance).to receive(:get).with(
|
46
|
-
'/api/v2/rules/test', fields: nil, include_fields: nil
|
46
|
+
'/api/v2/rules/test', { fields: nil, include_fields: nil }
|
47
47
|
)
|
48
48
|
expect { @instance.rule('test') }.not_to raise_error
|
49
49
|
end
|
@@ -57,7 +57,7 @@ describe Auth0::Api::V2::Rules do
|
|
57
57
|
it 'is expected to call post /api/v2/rules' do
|
58
58
|
expect(@instance).to receive(:post).with(
|
59
59
|
'/api/v2/rules',
|
60
|
-
name: 'test', script: 'script', order: 'order', enabled: false, stage: 'login_success'
|
60
|
+
{ name: 'test', script: 'script', order: 'order', enabled: false, stage: 'login_success' }
|
61
61
|
)
|
62
62
|
expect { @instance.create_rule('test', 'script', 'order', false) }.not_to raise_error
|
63
63
|
end
|
@@ -72,7 +72,7 @@ describe Auth0::Api::V2::Rules do
|
|
72
72
|
it { expect(@instance).to respond_to(:update_rule) }
|
73
73
|
it 'is expected to call put /api/v2/rules/test' do
|
74
74
|
expect(@instance).to receive(:patch).with(
|
75
|
-
'/api/v2/rules/test', script: 'script', order: 'order', enabled: true, stage: 'some_stage'
|
75
|
+
'/api/v2/rules/test', { script: 'script', order: 'order', enabled: true, stage: 'some_stage' }
|
76
76
|
)
|
77
77
|
expect do
|
78
78
|
@instance.update_rule('test', script: 'script', order: 'order', enabled: true, stage: 'some_stage')
|
@@ -15,7 +15,7 @@ describe Auth0::Api::V2::Stats do
|
|
15
15
|
context '.daily_stats' do
|
16
16
|
it { expect(@instance).to respond_to(:daily_stats) }
|
17
17
|
it 'expect client to send get to /api/v2/stats/daily' do
|
18
|
-
expect(@instance).to receive(:get).with('/api/v2/stats/daily', from: '20120222', to: '20151222')
|
18
|
+
expect(@instance).to receive(:get).with('/api/v2/stats/daily', { from: '20120222', to: '20151222' })
|
19
19
|
expect { @instance.daily_stats('20120222', '20151222') }.not_to raise_error
|
20
20
|
end
|
21
21
|
end
|
@@ -7,7 +7,7 @@ describe Auth0::Api::V2::Tenants do
|
|
7
7
|
context '.get_tenant_settings' do
|
8
8
|
it { expect(@instance).to respond_to(:get_tenant_settings) }
|
9
9
|
it 'expect client to send post to /api/v2/tenants/settings with fields' do
|
10
|
-
expect(@instance).to receive(:get).with('/api/v2/tenants/settings', fields: 'field', include_fields: true)
|
10
|
+
expect(@instance).to receive(:get).with('/api/v2/tenants/settings', { fields: 'field', include_fields: true })
|
11
11
|
expect { @instance.get_tenant_settings(fields: 'field') }.not_to raise_error
|
12
12
|
end
|
13
13
|
end
|
@@ -7,28 +7,28 @@ describe Auth0::Api::V2::Tickets do
|
|
7
7
|
context '.post_email_verification' do
|
8
8
|
it { expect(@instance).to respond_to(:post_email_verification) }
|
9
9
|
it 'expect client to send post to /api/v2/tickets/email-verification with body' do
|
10
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
|
11
|
-
result_url: nil, ttl_sec: nil)
|
10
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
|
11
|
+
result_url: nil, ttl_sec: nil })
|
12
12
|
expect { @instance.post_email_verification('user_id') }.not_to raise_error
|
13
13
|
end
|
14
14
|
it 'expect client to accept integer ttl_sec' do
|
15
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
|
16
|
-
result_url: nil, ttl_sec: 300)
|
15
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
|
16
|
+
result_url: nil, ttl_sec: 300 })
|
17
17
|
expect { @instance.post_email_verification('user_id', ttl_sec: 300) }.not_to raise_error
|
18
18
|
end
|
19
19
|
it 'expect client to return nil when calling with a non-integer ttl_sec' do
|
20
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
|
21
|
-
result_url: nil, ttl_sec: nil)
|
20
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
|
21
|
+
result_url: nil, ttl_sec: nil })
|
22
22
|
expect { @instance.post_email_verification('user_id', ttl_sec: "noninteger") }.not_to raise_error
|
23
23
|
end
|
24
24
|
it 'expect client to accept hash identity' do
|
25
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
|
25
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
|
26
26
|
result_url: nil,
|
27
27
|
ttl_sec: nil,
|
28
28
|
identity: {
|
29
29
|
provider: "auth0",
|
30
30
|
user_id: "user_id"
|
31
|
-
})
|
31
|
+
}})
|
32
32
|
expect {
|
33
33
|
@instance.post_email_verification('user_id', identity: { provider: "auth0", user_id: "user_id"})
|
34
34
|
}.not_to raise_error
|
@@ -48,7 +48,7 @@ describe Auth0::Api::V2::Tickets do
|
|
48
48
|
context '.post_password_change' do
|
49
49
|
it { expect(@instance).to respond_to(:post_password_change) }
|
50
50
|
it 'expect client to send post to /api/v2/tickets/password-change with body' do
|
51
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
|
51
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
|
52
52
|
result_url: nil,
|
53
53
|
user_id: nil,
|
54
54
|
connection_id: nil,
|
@@ -56,12 +56,12 @@ describe Auth0::Api::V2::Tickets do
|
|
56
56
|
ttl_sec: nil,
|
57
57
|
mark_email_as_verified: nil,
|
58
58
|
includeEmailInRedirect: nil,
|
59
|
-
new_password: nil)
|
59
|
+
new_password: nil })
|
60
60
|
expect {@instance.post_password_change}.not_to raise_error
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'expect client to accept organization_id' do
|
64
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
|
64
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
|
65
65
|
result_url: nil,
|
66
66
|
user_id: nil,
|
67
67
|
connection_id: nil,
|
@@ -72,7 +72,7 @@ describe Auth0::Api::V2::Tickets do
|
|
72
72
|
new_password: nil,
|
73
73
|
client_id: '123',
|
74
74
|
organization_id: '999'
|
75
|
-
)
|
75
|
+
})
|
76
76
|
expect {
|
77
77
|
@instance.post_password_change(
|
78
78
|
result_url: nil,
|
@@ -89,7 +89,7 @@ describe Auth0::Api::V2::Tickets do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'expect client to accept client_id' do
|
92
|
-
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
|
92
|
+
expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
|
93
93
|
result_url: nil,
|
94
94
|
user_id: nil,
|
95
95
|
connection_id: nil,
|
@@ -99,7 +99,7 @@ describe Auth0::Api::V2::Tickets do
|
|
99
99
|
includeEmailInRedirect: nil,
|
100
100
|
new_password: nil,
|
101
101
|
client_id: '123'
|
102
|
-
)
|
102
|
+
})
|
103
103
|
expect {
|
104
104
|
@instance.post_password_change(
|
105
105
|
result_url: nil,
|
@@ -9,7 +9,7 @@ describe Auth0::Api::V2::UserBlocks do
|
|
9
9
|
context '.user_blocks' do
|
10
10
|
it { expect(@instance).to respond_to(:user_blocks) }
|
11
11
|
it 'is expected to call /api/v2/user-blocks?identifier=Test' do
|
12
|
-
expect(@instance).to receive(:get).with('/api/v2/user-blocks', identifier: 'Test')
|
12
|
+
expect(@instance).to receive(:get).with('/api/v2/user-blocks', { identifier: 'Test' })
|
13
13
|
expect { @instance.user_blocks('Test') }.not_to raise_error
|
14
14
|
end
|
15
15
|
it 'expect client to raise an error when calling with empty identifier' do
|
@@ -20,7 +20,7 @@ describe Auth0::Api::V2::UserBlocks do
|
|
20
20
|
context '.delete_user_blocks' do
|
21
21
|
it { expect(@instance).to respond_to(:delete_user_blocks) }
|
22
22
|
it 'is expected to call /api/v2/user-blocks?identifier=Test' do
|
23
|
-
expect(@instance).to receive(:delete).with('/api/v2/user-blocks', identifier: 'Test')
|
23
|
+
expect(@instance).to receive(:delete).with('/api/v2/user-blocks', { identifier: 'Test' })
|
24
24
|
expect { @instance.delete_user_blocks('Test') }.not_to raise_error
|
25
25
|
end
|
26
26
|
it 'expect client to raise an error when calling with empty identifier' do
|
@@ -10,11 +10,11 @@ describe Auth0::Api::V2::UsersByEmail do
|
|
10
10
|
it { expect(@instance).to respond_to(:users_by_email) }
|
11
11
|
it 'is expected to call /api/v2/users-by-email' do
|
12
12
|
expect(@instance).to receive(:get).with(
|
13
|
-
'/api/v2/users-by-email',
|
13
|
+
'/api/v2/users-by-email', {
|
14
14
|
fields: nil,
|
15
15
|
include_fields: nil,
|
16
16
|
email: 'email'
|
17
|
-
)
|
17
|
+
})
|
18
18
|
expect { @instance.users_by_email('email') }.not_to raise_error
|
19
19
|
end
|
20
20
|
end
|