Sha256: bc94dd4217ed157a05deb5e8c0b879ead3e6230c4644c856304b1aea66bdf8a7

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

require 'chef/provisioning/fog_driver/providers/aws/credentials'

describe Chef::Provisioning::FogDriver::Providers::AWS::Credentials do
  let(:credentials) { Chef::Provisioning::FogDriver::Providers::AWS::Credentials.new }

  describe "#load_inis" do
    let(:aws_credentials_ini_file) { File.join(File.expand_path('../../../../support', __FILE__), 'aws/ini-file.ini') }

    before do
      credentials.load_inis(aws_credentials_ini_file)
    end

    it "should load a default profile" do
      expect(credentials['default']).to include(:aws_access_key_id)
    end

    it "should load the correct values" do
      expect(credentials['default'][:aws_access_key_id]).to eq 12345
      expect(credentials['default'][:aws_secret_access_key]).to eq "abcde"
      expect(credentials['default'][:region]).to eq "us-east-1"
      expect(credentials['default'][:aws_session_token]).to eq "mysecret"
    end

    it "should load several profiles" do
      expect(credentials.keys.length).to eq 2
    end
  end

  describe "#load_csv" do
    let(:aws_credentials_csv_file) { File.join(File.expand_path('../../../../support', __FILE__), 'aws/config-file.csv') }
    before do
      credentials.load_csv(aws_credentials_csv_file)
    end

    it "should load a single profile" do
      expect(credentials['test']).to include(:aws_access_key_id)
    end

    it "should load the correct values" do
      expect(credentials['test'][:aws_access_key_id]).to eq "67890"
    end

    it "should load several profiles" do
      expect(credentials.keys.length).to eq 1
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
chef-provisioning-fog-0.26.1 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.26.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.25.1 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.25.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.24.1 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.24.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.23.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.22.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.21.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.20.0 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.19.1 spec/unit/providers/aws/credentials_spec.rb
chef-provisioning-fog-0.19.0 spec/unit/providers/aws/credentials_spec.rb