Sha256: 49d9bbcf37bc8af14928b2f69781f87933f9474be97eec90e99747f5eeb9fe79

Contents?: true

Size: 1.51 KB

Versions: 37

Compression:

Stored size: 1.51 KB

Contents

Shindo.tests('AWS::EC2 | key pair requests', ['aws']) do

  tests('success') do

    @keypair_format = {
      'keyFingerprint'  => String,
      'keyMaterial'     => String,
      'keyName'         => String,
      'requestId'       => String
    }

    @keypairs_format = {
      'keySet' => [{
        'keyFingerprint' => String,
        'keyName' => String
      }],
      'requestId' => String
    }

    @key_pair_name = 'fog_key_pair'

    tests("#create_key_pair('#{@key_pair_name}')").formats(@keypair_format) do
      AWS[:ec2].create_key_pair(@key_pair_name).body
    end

    tests('#describe_key_pairs').formats(@keypairs_format) do
      AWS[:ec2].describe_key_pairs.body
    end

    tests("#describe_key_pairs(#{@key_pair_name})").formats(@keypairs_format) do
      AWS[:ec2].describe_key_pairs(@key_pair_name).body
    end

    tests("#delete_key_pair('#{@key_pair_name}')").formats(AWS::EC2::Formats::BASIC) do
      AWS[:ec2].delete_key_pair(@key_pair_name).body
    end

    tests("#delete_key_pair('not_a_key_name')").succeeds do
      AWS[:ec2].delete_key_pair('not_a_key_name')
    end

  end
  tests('failure') do

    @key_pair = AWS[:ec2].key_pairs.create(:name => 'fog_key_pair')

    tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Fog::AWS::EC2::Error) do
      AWS[:ec2].create_key_pair(@key_pair.name)
    end

    tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::NotFound) do
      AWS[:ec2].describe_key_pairs('not_a_key_name').body
    end

    @key_pair.destroy

  end

end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-0.2.30 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.28 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.27 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.26 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.25 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.24 tests/aws/requests/ec2/key_pair_tests.rb
tecnh-fog-0.2.23.vpc tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.23 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.22 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.21 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.20 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.19 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.18 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.17 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.16 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.15 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.14 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.13 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.12 tests/aws/requests/ec2/key_pair_tests.rb
fog-0.2.11 tests/aws/requests/ec2/key_pair_tests.rb