auth0 5.1.1 → 5.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 +4 -4
- data/.gitignore +5 -0
- data/CHANGELOG.md +45 -1
- data/README.md +1 -0
- data/auth0.gemspec +6 -6
- data/lib/auth0/api/v2/branding.rb +0 -1
- data/lib/auth0/api/v2/connections.rb +5 -2
- data/lib/auth0/api/v2/device_credentials.rb +3 -3
- data/lib/auth0/api/v2/logs.rb +2 -2
- data/lib/auth0/api/v2/organizations.rb +19 -3
- data/lib/auth0/api/v2/roles.rb +7 -3
- data/lib/auth0/exception.rb +1 -1
- data/lib/auth0/mixins/httpproxy.rb +13 -3
- data/lib/auth0/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +38 -26
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +38 -24
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +38 -26
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +41 -21
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +45 -24
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +75 -39
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +39 -28
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +37 -25
- data/spec/lib/auth0/api/v2/connections_spec.rb +1 -1
- data/spec/lib/auth0/api/v2/device_credentials_spec.rb +2 -2
- data/spec/lib/auth0/api/v2/organizations_spec.rb +31 -6
- data/spec/lib/auth0/api/v2/roles_spec.rb +5 -1
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +35 -33
- data/spec/support/dummy_class_for_proxy.rb +1 -2
- metadata +14 -19
- data/.yardoc/checksums +0 -22
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
|
@@ -12,54 +12,66 @@ http_interactions:
|
|
|
12
12
|
Accept-Encoding:
|
|
13
13
|
- gzip, deflate
|
|
14
14
|
User-Agent:
|
|
15
|
-
-
|
|
15
|
+
- rest-client/2.0.2 (darwin20.2.0 x86_64) ruby/2.7.2p137
|
|
16
16
|
Content-Type:
|
|
17
17
|
- application/json
|
|
18
18
|
Auth0-Client:
|
|
19
|
-
-
|
|
19
|
+
- eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjEuMiIsImVudiI6eyJydWJ5IjoiMi43LjIifX0=
|
|
20
20
|
Authorization:
|
|
21
21
|
- Bearer API_TOKEN
|
|
22
22
|
Content-Length:
|
|
23
23
|
- '53'
|
|
24
|
-
Host:
|
|
25
|
-
- auth0-sdk-tests.auth0.com
|
|
26
24
|
response:
|
|
27
25
|
status:
|
|
28
26
|
code: 201
|
|
29
27
|
message: Created
|
|
30
28
|
headers:
|
|
31
29
|
Date:
|
|
32
|
-
-
|
|
30
|
+
- Tue, 20 Jul 2021 02:06:03 GMT
|
|
33
31
|
Content-Type:
|
|
34
32
|
- application/json; charset=utf-8
|
|
35
33
|
Transfer-Encoding:
|
|
36
34
|
- chunked
|
|
37
35
|
Connection:
|
|
38
36
|
- keep-alive
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
X-Ratelimit-Remaining:
|
|
42
|
-
- '9'
|
|
43
|
-
X-Ratelimit-Reset:
|
|
44
|
-
- '1538770587'
|
|
45
|
-
Vary:
|
|
46
|
-
- origin,accept-encoding
|
|
37
|
+
Cf-Ray:
|
|
38
|
+
- 6718a0c42c0a323a-LAX
|
|
47
39
|
Cache-Control:
|
|
48
|
-
-
|
|
40
|
+
- no-cache
|
|
49
41
|
Content-Encoding:
|
|
50
42
|
- gzip
|
|
51
43
|
Strict-Transport-Security:
|
|
52
|
-
- max-age=
|
|
53
|
-
|
|
54
|
-
-
|
|
44
|
+
- max-age=31536000
|
|
45
|
+
Vary:
|
|
46
|
+
- origin,accept-encoding
|
|
47
|
+
Cf-Cache-Status:
|
|
48
|
+
- DYNAMIC
|
|
49
|
+
Expect-Ct:
|
|
50
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
|
51
|
+
Ot-Baggage-Auth0-Request-Id:
|
|
52
|
+
- 6718a0c42c0a323a
|
|
53
|
+
Ot-Tracer-Sampled:
|
|
54
|
+
- 'true'
|
|
55
|
+
Ot-Tracer-Spanid:
|
|
56
|
+
- 672b1d28532dec55
|
|
57
|
+
Ot-Tracer-Traceid:
|
|
58
|
+
- 1552b04c1ec626a6
|
|
59
|
+
X-Content-Type-Options:
|
|
60
|
+
- nosniff
|
|
61
|
+
X-Ratelimit-Limit:
|
|
62
|
+
- '50'
|
|
63
|
+
X-Ratelimit-Remaining:
|
|
64
|
+
- '49'
|
|
65
|
+
X-Ratelimit-Reset:
|
|
66
|
+
- '1626746764'
|
|
67
|
+
Server:
|
|
68
|
+
- cloudflare
|
|
69
|
+
Alt-Svc:
|
|
70
|
+
- h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
|
|
71
|
+
ma=86400
|
|
55
72
|
body:
|
|
56
73
|
encoding: ASCII-8BIT
|
|
57
74
|
string: !binary |-
|
|
58
|
-
H4sIAAAAAAAAA3WPQUvEQAyF/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
3SRsGLaYH6iaeMNxcTOKfuu3659aKb7Y565iyOfaBN5Q7YmJrpQbKd1iVaoH
|
|
62
|
-
UV3P2Udy4deHdvBJawyS7xL2LqSIZLX08bQ95FPe9n+pp/ULPGRgtDMBAAA=
|
|
63
|
-
http_version:
|
|
64
|
-
recorded_at: Fri, 05 Oct 2018 20:16:25 GMT
|
|
65
|
-
recorded_with: VCR 4.0.0
|
|
75
|
+
H4sIAAAAAAAAA3WPQUvEQAyF/0vOFUpPMke9LSgelAVlGaYzaR2YJiVJd7cs+9+duurNU0Je8r2XC+QEDiKTp/unXdudu3dtdw9v+2dogGfLTAruAtMQthKi5SOCM1mwAUFbhDyScCle0SzTqDf12sAcVE8s6YVLjmu1GZlTxapJMBxXf0TRagCua6CXxdAPLBH9LGwY7Vv6Yf3eVEpY7LOtGApTTQKvqPbIRLeDO1n61eqoLmT1iaeQycc/HdwQitbsSKEvmHwsGclq6I/D9lAo09b/Sz1cvwBFiD9BMwEAAA==
|
|
76
|
+
recorded_at: Tue, 20 Jul 2021 02:06:02 GMT
|
|
77
|
+
recorded_with: VCR 6.0.0
|
|
@@ -113,7 +113,7 @@ describe Auth0::Api::V2::Connections do
|
|
|
113
113
|
context '.delete_connection_user' do
|
|
114
114
|
it { expect(@instance).to respond_to(:delete_connection_user) }
|
|
115
115
|
it 'is expected to call delete to /api/v2/connections/connectionId/users' do
|
|
116
|
-
expect(@instance).to receive(:delete).with('/api/v2/connections/connectionId/users
|
|
116
|
+
expect(@instance).to receive(:delete).with('/api/v2/connections/connectionId/users', email: 'email@test.com')
|
|
117
117
|
@instance.delete_connection_user('connectionId', 'email@test.com')
|
|
118
118
|
end
|
|
119
119
|
|
|
@@ -22,9 +22,9 @@ describe Auth0::Api::V2::DeviceCredentials do
|
|
|
22
22
|
)
|
|
23
23
|
expect { @instance.device_credentials(client_id) }.not_to raise_error
|
|
24
24
|
end
|
|
25
|
-
it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\'' do
|
|
25
|
+
it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\'' do
|
|
26
26
|
expect { @instance.device_credentials(client_id, type: 'invalid_type') }.to raise_error(
|
|
27
|
-
'Type must be one of \'public_key\', \'refresh_token\''
|
|
27
|
+
'Type must be one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\''
|
|
28
28
|
)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -20,6 +20,8 @@ describe Auth0::Api::V2::Organizations do
|
|
|
20
20
|
'/api/v2/organizations',
|
|
21
21
|
per_page: nil,
|
|
22
22
|
page: nil,
|
|
23
|
+
from: nil,
|
|
24
|
+
take: nil,
|
|
23
25
|
include_totals: nil
|
|
24
26
|
)
|
|
25
27
|
expect { @instance.organizations }.not_to raise_error
|
|
@@ -30,12 +32,16 @@ describe Auth0::Api::V2::Organizations do
|
|
|
30
32
|
'/api/v2/organizations',
|
|
31
33
|
per_page: 10,
|
|
32
34
|
page: 1,
|
|
35
|
+
from: 'org_id',
|
|
36
|
+
take: 50,
|
|
33
37
|
include_totals: true
|
|
34
38
|
)
|
|
35
39
|
expect do
|
|
36
40
|
@instance.organizations(
|
|
37
41
|
per_page: 10,
|
|
38
42
|
page: 1,
|
|
43
|
+
from: 'org_id',
|
|
44
|
+
take: 50,
|
|
39
45
|
include_totals: true
|
|
40
46
|
)
|
|
41
47
|
end.not_to raise_error
|
|
@@ -438,19 +444,38 @@ describe Auth0::Api::V2::Organizations do
|
|
|
438
444
|
expect { @instance.get_organizations_members(nil) }.to raise_exception(Auth0::MissingOrganizationId)
|
|
439
445
|
end
|
|
440
446
|
|
|
441
|
-
it 'is expected to get
|
|
447
|
+
it 'is expected to get members for an org' do
|
|
442
448
|
expect(@instance).to receive(:get).with(
|
|
443
|
-
'/api/v2/organizations/org_id/members'
|
|
449
|
+
'/api/v2/organizations/org_id/members',
|
|
450
|
+
per_page: nil,
|
|
451
|
+
page: nil,
|
|
452
|
+
from: nil,
|
|
453
|
+
take: nil,
|
|
454
|
+
include_totals: nil
|
|
444
455
|
)
|
|
445
|
-
expect
|
|
456
|
+
expect do
|
|
457
|
+
@instance.get_organizations_members('org_id')
|
|
458
|
+
end.not_to raise_error
|
|
446
459
|
end
|
|
447
460
|
|
|
448
|
-
it 'is expected to get
|
|
461
|
+
it 'is expected to get /api/v2/organizations with custom parameters' do
|
|
449
462
|
expect(@instance).to receive(:get).with(
|
|
450
|
-
'/api/v2/organizations/org_id/members'
|
|
463
|
+
'/api/v2/organizations/org_id/members',
|
|
464
|
+
per_page: 10,
|
|
465
|
+
page: 1,
|
|
466
|
+
from: 'org_id',
|
|
467
|
+
take: 50,
|
|
468
|
+
include_totals: true
|
|
451
469
|
)
|
|
452
470
|
expect do
|
|
453
|
-
@instance.get_organizations_members(
|
|
471
|
+
@instance.get_organizations_members(
|
|
472
|
+
'org_id',
|
|
473
|
+
per_page: 10,
|
|
474
|
+
page: 1,
|
|
475
|
+
from: 'org_id',
|
|
476
|
+
take: 50,
|
|
477
|
+
include_totals: true
|
|
478
|
+
)
|
|
454
479
|
end.not_to raise_error
|
|
455
480
|
end
|
|
456
481
|
end
|
|
@@ -152,6 +152,8 @@ describe Auth0::Api::V2::Roles do
|
|
|
152
152
|
'/api/v2/roles/ROLE_ID/users',
|
|
153
153
|
per_page: nil,
|
|
154
154
|
page: nil,
|
|
155
|
+
from: nil,
|
|
156
|
+
take: nil,
|
|
155
157
|
include_totals: nil
|
|
156
158
|
)
|
|
157
159
|
expect { @instance.get_role_users('ROLE_ID') }.not_to raise_error
|
|
@@ -162,10 +164,12 @@ describe Auth0::Api::V2::Roles do
|
|
|
162
164
|
'/api/v2/roles/ROLE_ID/users',
|
|
163
165
|
per_page: 30,
|
|
164
166
|
page: 4,
|
|
167
|
+
from: 'org_id',
|
|
168
|
+
take: 50,
|
|
165
169
|
include_totals: true
|
|
166
170
|
)
|
|
167
171
|
expect do
|
|
168
|
-
@instance.get_role_users('ROLE_ID', per_page: 30, page: 4, include_totals: true)
|
|
172
|
+
@instance.get_role_users('ROLE_ID', per_page: 30, page: 4, from: 'org_id', take: 50, include_totals: true)
|
|
169
173
|
end.not_to raise_error
|
|
170
174
|
end
|
|
171
175
|
end
|
|
@@ -5,6 +5,8 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
5
5
|
before :each do
|
|
6
6
|
dummy_instance = DummyClassForProxy.new
|
|
7
7
|
dummy_instance.extend(Auth0::Mixins::HTTPProxy)
|
|
8
|
+
dummy_instance.base_uri = "https://auth0.com"
|
|
9
|
+
|
|
8
10
|
@instance = dummy_instance
|
|
9
11
|
@exception = DummyClassForRestClient.new
|
|
10
12
|
end
|
|
@@ -14,7 +16,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
14
16
|
it { expect(@instance).to respond_to(http_method.to_sym) }
|
|
15
17
|
it "should call send http #{http_method} method to path defined through HTTP" do
|
|
16
18
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
17
|
-
url: '/test',
|
|
19
|
+
url: 'https://auth0.com/test',
|
|
18
20
|
timeout: nil,
|
|
19
21
|
headers: { params: {} },
|
|
20
22
|
payload: nil)
|
|
@@ -24,7 +26,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
24
26
|
|
|
25
27
|
it 'should not raise exception if data returned not in json format (should be fixed in v2)' do
|
|
26
28
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
27
|
-
url: '/test',
|
|
29
|
+
url: 'https://auth0.com/test',
|
|
28
30
|
timeout: nil,
|
|
29
31
|
headers: { params: {} },
|
|
30
32
|
payload: nil)
|
|
@@ -36,7 +38,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
36
38
|
it "should raise Auth0::Unauthorized on send http #{http_method}
|
|
37
39
|
method to path defined through HTTP when 401 status received" do
|
|
38
40
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
39
|
-
url: '/test',
|
|
41
|
+
url: 'https://auth0.com/test',
|
|
40
42
|
timeout: nil,
|
|
41
43
|
headers: { params: {} },
|
|
42
44
|
payload: nil)
|
|
@@ -47,7 +49,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
47
49
|
it "should raise Auth0::NotFound on send http #{http_method} method
|
|
48
50
|
to path defined through HTTP when 404 status received" do
|
|
49
51
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
50
|
-
url: '/test',
|
|
52
|
+
url: 'https://auth0.com/test',
|
|
51
53
|
timeout: nil,
|
|
52
54
|
headers: { params: {} },
|
|
53
55
|
payload: nil)
|
|
@@ -58,7 +60,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
58
60
|
it "should raise Auth0::Unsupported on send http #{http_method} method
|
|
59
61
|
to path defined through HTTP when 418 or other unknown status received" do
|
|
60
62
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
61
|
-
url: '/test',
|
|
63
|
+
url: 'https://auth0.com/test',
|
|
62
64
|
timeout: nil,
|
|
63
65
|
headers: { params: {} },
|
|
64
66
|
payload: nil)
|
|
@@ -69,7 +71,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
69
71
|
it "should raise Auth0::RequestTimeout on send http #{http_method} method
|
|
70
72
|
to path defined through HTTP when RestClient::RequestTimeout received" do
|
|
71
73
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
72
|
-
url: '/test',
|
|
74
|
+
url: 'https://auth0.com/test',
|
|
73
75
|
timeout: nil,
|
|
74
76
|
headers: { params: {} },
|
|
75
77
|
payload: nil)
|
|
@@ -81,7 +83,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
81
83
|
to path defined through HTTP when 400 status received" do
|
|
82
84
|
@exception.response = StubResponse.new({}, false, 400)
|
|
83
85
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
84
|
-
url: '/test',
|
|
86
|
+
url: 'https://auth0.com/test',
|
|
85
87
|
timeout: nil,
|
|
86
88
|
headers: { params: {} },
|
|
87
89
|
payload: nil)
|
|
@@ -93,7 +95,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
93
95
|
to path defined through HTTP when 403" do
|
|
94
96
|
@exception.response = StubResponse.new({}, false, 403)
|
|
95
97
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
96
|
-
url: '/test',
|
|
98
|
+
url: 'https://auth0.com/test',
|
|
97
99
|
timeout: nil,
|
|
98
100
|
headers: { params: {} },
|
|
99
101
|
payload: nil)
|
|
@@ -104,13 +106,13 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
104
106
|
it "should raise Auth0::RateLimitEncountered on send http #{http_method} method
|
|
105
107
|
to path defined through HTTP when 429 recieved" do
|
|
106
108
|
headers = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
:x_ratelimit_limit => 10,
|
|
110
|
+
:x_ratelimit_remaining => 0,
|
|
111
|
+
:x_ratelimit_reset => 1560564149
|
|
110
112
|
}
|
|
111
113
|
@exception.response = StubResponse.new({}, false, 429, headers)
|
|
112
114
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
113
|
-
url: '/test',
|
|
115
|
+
url: 'https://auth0.com/test',
|
|
114
116
|
timeout: nil,
|
|
115
117
|
headers: { params: {} },
|
|
116
118
|
payload: nil)
|
|
@@ -127,13 +129,13 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
127
129
|
reset: Time.at(1560564149)
|
|
128
130
|
)
|
|
129
131
|
}
|
|
130
|
-
end
|
|
132
|
+
end
|
|
131
133
|
|
|
132
134
|
it "should raise Auth0::ServerError on send http #{http_method} method
|
|
133
135
|
to path defined through HTTP when 500 received" do
|
|
134
136
|
@exception.response = StubResponse.new({}, false, 500)
|
|
135
137
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
136
|
-
url: '/test',
|
|
138
|
+
url: 'https://auth0.com/test',
|
|
137
139
|
timeout: nil,
|
|
138
140
|
headers: { params: {} },
|
|
139
141
|
payload: nil)
|
|
@@ -141,14 +143,14 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
141
143
|
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::ServerError)
|
|
142
144
|
end
|
|
143
145
|
|
|
144
|
-
it 'should
|
|
146
|
+
it 'should normalize path with Addressable::URI' do
|
|
145
147
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
146
|
-
url: '/te%20st',
|
|
148
|
+
url: 'https://auth0.com/te%20st%23test',
|
|
147
149
|
timeout: nil,
|
|
148
150
|
headers: { params: {} },
|
|
149
151
|
payload: nil)
|
|
150
152
|
.and_return(StubResponse.new({}, true, 200))
|
|
151
|
-
expect { @instance.send(http_method, '/te st') }.not_to raise_error
|
|
153
|
+
expect { @instance.send(http_method, '/te st#test') }.not_to raise_error
|
|
152
154
|
end
|
|
153
155
|
end
|
|
154
156
|
end
|
|
@@ -158,7 +160,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
158
160
|
it { expect(@instance).to respond_to(http_method.to_sym) }
|
|
159
161
|
it "should call send http #{http_method} method to path defined through HTTP" do
|
|
160
162
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
161
|
-
url: '/test',
|
|
163
|
+
url: 'https://auth0.com/test',
|
|
162
164
|
timeout: nil,
|
|
163
165
|
headers: nil,
|
|
164
166
|
payload: '{}')
|
|
@@ -168,7 +170,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
168
170
|
|
|
169
171
|
it 'should not raise exception if data returned not in json format (should be fixed in v2)' do
|
|
170
172
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
171
|
-
url: '/test',
|
|
173
|
+
url: 'https://auth0.com/test',
|
|
172
174
|
timeout: nil,
|
|
173
175
|
headers: nil,
|
|
174
176
|
payload: '{}')
|
|
@@ -181,24 +183,24 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
181
183
|
to path defined through HTTP when 401 status received" do
|
|
182
184
|
@exception.response = StubResponse.new({}, false, 401)
|
|
183
185
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
184
|
-
url: '/test',
|
|
186
|
+
url: 'https://auth0.com/test',
|
|
185
187
|
timeout: nil,
|
|
186
188
|
headers: nil,
|
|
187
189
|
payload: '{}')
|
|
188
190
|
.and_raise(@exception)
|
|
189
191
|
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unauthorized)
|
|
190
192
|
end
|
|
191
|
-
|
|
193
|
+
|
|
192
194
|
it "should raise Auth0::RateLimitEncountered on send http #{http_method} method
|
|
193
195
|
to path defined through HTTP when 429 status received" do
|
|
194
196
|
headers = {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
:x_ratelimit_limit => 10,
|
|
198
|
+
:x_ratelimit_remaining => 0,
|
|
199
|
+
:x_ratelimit_reset => 1560564149
|
|
198
200
|
}
|
|
199
201
|
@exception.response = StubResponse.new({}, false, 429,headers)
|
|
200
202
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
201
|
-
url: '/test',
|
|
203
|
+
url: 'https://auth0.com/test',
|
|
202
204
|
timeout: nil,
|
|
203
205
|
headers: nil,
|
|
204
206
|
payload: '{}')
|
|
@@ -221,7 +223,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
221
223
|
to path defined through HTTP when 404 status received" do
|
|
222
224
|
@exception.response = StubResponse.new({}, false, 404)
|
|
223
225
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
224
|
-
url: '/test',
|
|
226
|
+
url: 'https://auth0.com/test',
|
|
225
227
|
timeout: nil,
|
|
226
228
|
headers: nil,
|
|
227
229
|
payload: '{}')
|
|
@@ -233,7 +235,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
233
235
|
to path defined through HTTP when 418 or other unknown status received" do
|
|
234
236
|
@exception.response = StubResponse.new({}, false, 418)
|
|
235
237
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
236
|
-
url: '/test',
|
|
238
|
+
url: 'https://auth0.com/test',
|
|
237
239
|
timeout: nil,
|
|
238
240
|
headers: nil,
|
|
239
241
|
payload: '{}')
|
|
@@ -244,7 +246,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
244
246
|
it "should raise Auth0::RequestTimeout on send http #{http_method} method
|
|
245
247
|
to path defined through HTTP when RestClient::RequestTimeout received" do
|
|
246
248
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
247
|
-
url: '/test',
|
|
249
|
+
url: 'https://auth0.com/test',
|
|
248
250
|
timeout: nil,
|
|
249
251
|
headers: nil,
|
|
250
252
|
payload: '{}')
|
|
@@ -256,7 +258,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
256
258
|
to path defined through HTTP when 400 status received" do
|
|
257
259
|
@exception.response = StubResponse.new({}, false, 400)
|
|
258
260
|
allow(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
259
|
-
url: '/test',
|
|
261
|
+
url: 'https://auth0.com/test',
|
|
260
262
|
timeout: nil,
|
|
261
263
|
headers: nil,
|
|
262
264
|
payload: '{}')
|
|
@@ -267,7 +269,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
267
269
|
it "should raise Auth0::ServerError on send http #{http_method} method
|
|
268
270
|
to path defined through HTTP when 500 received" do
|
|
269
271
|
@exception.response = StubResponse.new({}, false, 500)
|
|
270
|
-
allow(RestClient::Request).to receive(:execute).with(method: http_method, url: '/test',
|
|
272
|
+
allow(RestClient::Request).to receive(:execute).with(method: http_method, url: 'https://auth0.com/test',
|
|
271
273
|
timeout: nil,
|
|
272
274
|
headers: nil,
|
|
273
275
|
payload: '{}')
|
|
@@ -275,9 +277,9 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
275
277
|
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::ServerError)
|
|
276
278
|
end
|
|
277
279
|
|
|
278
|
-
it 'should
|
|
280
|
+
it 'should normalize path with Addressable::URI' do
|
|
279
281
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
280
|
-
url: '/te%20st',
|
|
282
|
+
url: 'https://auth0.com/te%20st',
|
|
281
283
|
timeout: nil,
|
|
282
284
|
headers: nil,
|
|
283
285
|
payload: '{}')
|
|
@@ -292,7 +294,7 @@ describe Auth0::Mixins::HTTPProxy do
|
|
|
292
294
|
3241312' on property id (The user_id of the user to retrieve).",
|
|
293
295
|
'errorCode' => 'invalid_uri')
|
|
294
296
|
expect(RestClient::Request).to receive(:execute).with(method: http_method,
|
|
295
|
-
url: '/test',
|
|
297
|
+
url: 'https://auth0.com/test',
|
|
296
298
|
timeout: nil,
|
|
297
299
|
headers: nil,
|
|
298
300
|
payload: '{}')
|