Module: G5Authenticatable::Test::TokenValidationHelpers
- Defined in:
- lib/g5_authenticatable/test/token_validation_helpers.rb
Overview
Helpers for stubbing token validation requests
Instance Method Summary collapse
Instance Method Details
#stub_invalid_access_token(token_value) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/g5_authenticatable/test/token_validation_helpers.rb', line 13 def stub_invalid_access_token(token_value) stub_request(:get, "#{ENV['G5_AUTH_ENDPOINT']}/oauth/token/info") .with(headers: { 'Authorization' => "Bearer #{token_value}" }) .to_return(status: 401, headers: { 'Content-Type' => 'application/json;' \ ' charset=utf-8', 'Cache-Control' => 'no-cache' }, body: { 'error' => 'invalid_token', 'error_description' => 'The access token expired' } .to_json) end |
#stub_valid_access_token(token_value) ⇒ Object
7 8 9 10 11 |
# File 'lib/g5_authenticatable/test/token_validation_helpers.rb', line 7 def stub_valid_access_token(token_value) stub_request(:get, "#{ENV['G5_AUTH_ENDPOINT']}/oauth/token/info") .with(headers: { 'Authorization' => "Bearer #{token_value}" }) .to_return(status: 200, body: '', headers: {}) end |