Sha256: 2d704605d94725abe4b10c8af9e6717ed2d7acfbca6ccc3226260316f55a5bf5

Contents?: true

Size: 1.78 KB

Versions: 11

Compression:

Stored size: 1.78 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'EC2.describe_security_groups' do
  describe 'success' do

    before(:each) do
      ec2.create_security_group('fog_security_group', 'a security group for testing fog')
    end

    after(:each) do
      ec2.delete_security_group('fog_security_group')
    end

    it "should return proper attributes with no params" do
      actual = ec2.describe_security_groups
      actual.body['requestId'].should be_a(String)
      actual.body['securityGroupInfo'].should be_an(Array)
      security_group = actual.body['securityGroupInfo'].select do |security_group| 
        security_group['groupName'] == 'fog_security_group'
      end.first
      security_group['groupDescription'].should be_a(String)
      security_group['groupName'].should be_a(String)
      security_group['ownerId'].should be_a(String)
      security_group['ipPermissions'].should be_an(Array)

    end

    it "should return proper attributes with params" do
      actual = ec2.describe_security_groups('fog_security_group')
      actual.body['requestId'].should be_a(String)
      actual.body['securityGroupInfo'].should be_an(Array)
      security_group = actual.body['securityGroupInfo'].select do |security_group| 
        security_group['groupName'] == 'fog_security_group'
      end.first
      security_group['groupDescription'].should be_a(String)
      security_group['groupName'].should be_a(String)
      security_group['ownerId'].should be_a(String)
      security_group['ipPermissions'].should be_an(Array)
    end

  end
  describe 'failure' do

    it "should raise a BadRequest error if the security group does not exist" do
      lambda {
        ec2.describe_security_groups('not_a_security_group')
      }.should raise_error(Excon::Errors::BadRequest)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-0.0.40 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.39 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.38 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.37 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.36 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.35 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.34 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.33 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.32 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.31 spec/aws/requests/ec2/describe_security_groups_spec.rb
fog-0.0.30 spec/aws/requests/ec2/describe_security_groups_spec.rb