|
49 | 49 | context 'AuthenticationEndponts' do
|
50 | 50 | context 'api_token' do
|
51 | 51 | it 'requests a new token using client_secret' do
|
52 |
| - expect(RestClient::Request).to receive(:execute).with(hash_including( |
| 52 | + expect(Auth0::HttpClient).to receive(:execute).with(hash_including( |
53 | 53 | method: :post,
|
54 | 54 | url: 'https://samples.auth0.com/oauth/token',
|
55 | 55 | payload: {
|
|
76 | 76 | end
|
77 | 77 |
|
78 | 78 | it 'requests a new token using organization' do
|
79 |
| - expect(RestClient::Request).to receive(:execute).with(hash_including( |
| 79 | + expect(Auth0::HttpClient).to receive(:execute).with(hash_including( |
80 | 80 | method: :post,
|
81 | 81 | url: 'https://samples.auth0.com/oauth/token',
|
82 | 82 | payload: {
|
|
103 | 103 | end
|
104 | 104 |
|
105 | 105 | it 'requests a new token using client_assertion' do
|
106 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 106 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
107 | 107 | expect(arg).to match(
|
108 | 108 | include(
|
109 | 109 | method: :post,
|
|
135 | 135 |
|
136 | 136 | context 'exchange_auth_code_for_tokens' do
|
137 | 137 | it 'requests a new token using client_secret' do
|
138 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 138 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
139 | 139 | expect(arg).to match(
|
140 | 140 | include(
|
141 | 141 | method: :post,
|
|
168 | 168 | end
|
169 | 169 |
|
170 | 170 | it 'requests a new token using client_assertion' do
|
171 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 171 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
172 | 172 | expect(arg).to match(
|
173 | 173 | include(
|
174 | 174 | method: :post,
|
|
201 | 201 |
|
202 | 202 | context 'exchange_refresh_token' do
|
203 | 203 | it 'exchanges the refresh token using a client secret' do
|
204 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 204 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
205 | 205 | expect(arg).to match(
|
206 | 206 | include(
|
207 | 207 | method: :post,
|
|
233 | 233 | end
|
234 | 234 |
|
235 | 235 | it 'exchanges the refresh token using client_assertion' do
|
236 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 236 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
237 | 237 | expect(arg).to match(
|
238 | 238 | include(
|
239 | 239 | method: :post,
|
|
268 | 268 |
|
269 | 269 | context 'exchange_sms_otp_for_tokens' do
|
270 | 270 | it 'requests the tokens using an OTP from SMS' do
|
271 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 271 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
272 | 272 | expect(arg).to match(
|
273 | 273 | include(
|
274 | 274 | method: :post,
|
|
304 | 304 | end
|
305 | 305 |
|
306 | 306 | it 'requests the tokens using OTP from SMS, and overrides scope and audience' do
|
307 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 307 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
308 | 308 | expect(arg).to match(
|
309 | 309 | include(
|
310 | 310 | method: :post,
|
|
337 | 337 | end
|
338 | 338 |
|
339 | 339 | it 'requests the tokens using an OTP from SMS using client assertion' do
|
340 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 340 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
341 | 341 | expect(arg).to match(
|
342 | 342 | include(
|
343 | 343 | method: :post,
|
|
366 | 366 |
|
367 | 367 | context 'exchange_email_otp_for_tokens' do
|
368 | 368 | it 'requests the tokens using email OTP' do
|
369 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 369 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
370 | 370 | expect(arg).to match(
|
371 | 371 | include(
|
372 | 372 | method: :post,
|
|
402 | 402 | end
|
403 | 403 |
|
404 | 404 | it 'requests the tokens using OTP from email, and overrides scope and audience' do
|
405 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 405 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
406 | 406 | expect(arg).to match(
|
407 | 407 | include(
|
408 | 408 | method: :post,
|
|
430 | 430 | end
|
431 | 431 |
|
432 | 432 | it 'requests the tokens using OTP from email using client assertion' do
|
433 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 433 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
434 | 434 | expect(arg).to match(
|
435 | 435 | include(
|
436 | 436 | method: :post,
|
|
462 | 462 |
|
463 | 463 | context 'login_with_resource_owner' do
|
464 | 464 | it 'logs in using a client secret' do
|
465 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 465 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
466 | 466 | expect(arg).to match(
|
467 | 467 | include(
|
468 | 468 | method: :post,
|
|
498 | 498 | end
|
499 | 499 |
|
500 | 500 | it 'logs in using a client secret, realm and audience' do
|
501 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 501 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
502 | 502 | expect(arg).to match(
|
503 | 503 | include(
|
504 | 504 | method: :post,
|
|
534 | 534 | end
|
535 | 535 |
|
536 | 536 | it 'logs in using client assertion' do
|
537 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 537 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
538 | 538 | expect(arg).to match(
|
539 | 539 | include(
|
540 | 540 | method: :post,
|
|
568 | 568 |
|
569 | 569 | context 'start_passwordless_email_flow' do
|
570 | 570 | it 'starts passwordless flow using a client secret' do
|
571 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 571 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
572 | 572 | expect(arg).to match(
|
573 | 573 | include(
|
574 | 574 | method: :post,
|
|
592 | 592 | end
|
593 | 593 |
|
594 | 594 | it 'starts passwordless email flow using client assertion' do
|
595 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 595 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
596 | 596 | expect(arg).to match(
|
597 | 597 | include(
|
598 | 598 | method: :post,
|
|
615 | 615 |
|
616 | 616 | context 'start_passwordless_sms_flow' do
|
617 | 617 | it 'starts passwordless flow using a client secret' do
|
618 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 618 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
619 | 619 | expect(arg).to match(
|
620 | 620 | include(
|
621 | 621 | method: :post,
|
|
637 | 637 | end
|
638 | 638 |
|
639 | 639 | it 'starts passwordless email flow using client assertion' do
|
640 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 640 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
641 | 641 | expect(arg).to match(
|
642 | 642 | include(
|
643 | 643 | method: :post,
|
|
675 | 675 |
|
676 | 676 | context 'pushed_authorization_request' do
|
677 | 677 | it 'sends the request as a form post' do
|
678 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 678 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
679 | 679 | expect(arg[:url]).to eq('https://samples.auth0.com/oauth/par')
|
680 | 680 | expect(arg[:method]).to eq(:post)
|
681 | 681 |
|
|
692 | 692 | end
|
693 | 693 |
|
694 | 694 | it 'allows the RestClient to handle the correct header defaults' do
|
695 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 695 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
696 | 696 | expect(arg[:headers]).not_to have_key('Content-Type')
|
697 | 697 |
|
698 | 698 | StubResponse.new({}, true, 200)
|
|
703 | 703 | end
|
704 | 704 |
|
705 | 705 | it 'sends the request as a form post with all known overrides' do
|
706 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 706 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
707 | 707 | expect(arg[:url]).to eq('https://samples.auth0.com/oauth/par')
|
708 | 708 | expect(arg[:method]).to eq(:post)
|
709 | 709 |
|
|
733 | 733 | end
|
734 | 734 |
|
735 | 735 | it 'sends the request as a form post using client assertion' do
|
736 |
| - expect(RestClient::Request).to receive(:execute) do |arg| |
| 736 | + expect(Auth0::HttpClient).to receive(:execute) do |arg| |
737 | 737 | expect(arg[:url]).to eq('https://samples.auth0.com/oauth/par')
|
738 | 738 | expect(arg[:method]).to eq(:post)
|
739 | 739 | expect(arg[:payload][:client_secret]).to be_nil
|
|
0 commit comments