Sha256: a4e8823bb8e8e6d38cdd2787c672ca23a8cec38ab8ead171b2f996a7de56d910

Contents?: true

Size: 1.18 KB

Versions: 36

Compression:

Stored size: 1.18 KB

Contents

require "spec_helper"

describe Fog::Brightbox::OAuth2::RefreshTokenStrategy do
  before do
    @client_id = "app-12345"
    @client_secret = "__mashed_keys_123__"
    @refresh_token = "ab4b39dddf909"
    options = { :refresh_token => @refresh_token }
    @credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
    @strategy = Fog::Brightbox::OAuth2::RefreshTokenStrategy.new(@credentials)
  end

  it "tests #respond_to?(:authorization_body_data) returns true"  do
    assert @strategy.respond_to?(:authorization_body_data)
  end

  it "tests #respond_to?(:headers) returns true"  do
    assert @strategy.respond_to?(:headers)
  end

  it "tests #authorization_body_data" do
    authorization_body_data = @strategy.authorization_body_data
    assert_equal "refresh_token", authorization_body_data["grant_type"]
    assert_equal @refresh_token, authorization_body_data["refresh_token"]
    refute_includes authorization_body_data, "client_id"
  end

  it "tests #headers" do
    headers = @strategy.headers
    assert_equal "Basic YXBwLTEyMzQ1Ol9fbWFzaGVkX2tleXNfMTIzX18=", headers["Authorization"]
    assert_equal "application/json", headers["Content-Type"]
  end
end

Version data entries

36 entries across 34 versions & 3 rubygems

Version Path
fog-brightbox-1.10.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.9.1 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.9.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.8.2 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.8.1 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.8.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.7.3 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.7.2 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.7.1 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.7.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.6.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.5.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.5.0.rc1 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.4.2 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.4.1 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.4.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.3.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.2.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.1.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb
fog-brightbox-1.0.0 spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb