Sha256: cbcd9613625bd75e77d99ef68da85843c18eb6ffe43735ba23174d1fc0338bb7

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

module Propono
  class AwsConfigTest < Minitest::Test

    def setup
      super
      @config = Propono::Configuration.new

      @config.access_key = "test-access-key"
      @config.secret_key = "test-secret-key"
      @config.queue_region = "test-queue-region"

      @aws_config = Propono::AwsConfig.new(@config)
    end

    def test_access_key
      assert_equal "test-access-key", @aws_config.aws_options[:aws_access_key_id]
    end

    def test_secret_key
      assert_equal "test-secret-key", @aws_config.aws_options[:aws_secret_access_key]
    end

    def test_region
      assert_equal "test-queue-region", @aws_config.aws_options[:region]
    end

    def test_no_iam_profile_selected
      assert ! @aws_config.aws_options.has_key?(:use_iam_profile)
    end

    def test_use_iam_profile
      @config.use_iam_profile = true
      assert @aws_config.aws_options[:use_iam_profile]
    end

    def test_selecting_use_iam_profile_results_in_no_access_key
      @config.use_iam_profile = true
      assert ! @aws_config.aws_options.has_key?(:aws_access_key_id)
    end

    def test_selecting_use_iam_profile_results_in_no_secret_key
      @config.use_iam_profile = true
      assert ! @aws_config.aws_options.has_key?(:aws_secret_access_key)
    end

    def test_region_when_using_iam_profile
      @config.use_iam_profile = true
      assert_equal "test-queue-region", @aws_config.aws_options[:region]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
propono-1.7.0 test/components/aws_config_test.rb
propono-1.6.0 test/components/aws_config_test.rb
propono-1.5.0 test/components/aws_config_test.rb
propono-1.4.0 test/components/aws_config_test.rb