Module: G5Authenticatable::Test::TokenValidationHelpers
- Defined in:
- lib/g5_authenticatable/test/token_validation_helpers.rb
Instance Method Summary collapse
Instance Method Details
#stub_invalid_access_token(token_value) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/g5_authenticatable/test/token_validation_helpers.rb', line 10 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
4 5 6 7 8 |
# File 'lib/g5_authenticatable/test/token_validation_helpers.rb', line 4 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 |