Sha256: db4564fffa684ffeadbc678746bb4a8ba034555730b06f61a7bdc230eff3f741

Contents?: true

Size: 970 Bytes

Versions: 18

Compression:

Stored size: 970 Bytes

Contents

module G5Authenticatable
  module Test
    module TokenValidationHelpers
      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

      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
    end
  end
end

RSpec.configure do |config|
  config.include G5Authenticatable::Test::TokenValidationHelpers
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
g5_authenticatable-0.9.1.pre.2 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.8.1.pre lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.8.0 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.8.0.beta1 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.5 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.5.beta lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.4 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.4.beta.1 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.3 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.2 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.1 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.7.0 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.6.0 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.5.1 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.5.0 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.4.2 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.4.1 lib/g5_authenticatable/test/token_validation_helpers.rb
g5_authenticatable-0.4.0 lib/g5_authenticatable/test/token_validation_helpers.rb