Sha256: c0005204eebb5da968ddd4e1bfd54b6a242b3351c06869d556d521cb612cfd7a

Contents?: true

Size: 1.89 KB

Versions: 19

Compression:

Stored size: 1.89 KB

Contents

Shindo.tests("Fog::Compute[:openstack] | security_group", ['openstack']) do
  tests('success') do
    begin
      fog = Fog::Compute[:openstack]

      security_group = fog.security_groups.create(
        :name        => 'my_group',
        :description => 'my group'
      )

      tests('#create').succeeds do
        security_group = fog.security_groups.create(
          :name        => 'my_group',
          :description => 'my group'
        )

        returns('my_group') { security_group.name }
        returns('my group') { security_group.description }
        returns([])         { security_group.security_group_rules }
        returns(true)       { security_group.tenant_id != nil }
      end

      tests('#rules').succeeds do
        tests("#create").succeeds do
          rules_count = security_group.security_group_rules.count
          rule        = security_group.security_group_rules.create(
            :parent_group_id => security_group.id,
            :ip_protocol     => 'tcp',
            :from_port       => 1234,
            :to_port         => 1234,
            :ip_range        => { "cidr" => "0.0.0.0/0" }
          )
          returns(true) { security_group.security_group_rules.count == (rules_count + 1) }
          security_group_rule = security_group.security_group_rules.detect { |r| r.id == rule.id }
          returns(true) { security_group_rule.attributes == rule.attributes }
        end

        tests("#destroy").succeeds do
          rule        = security_group.security_group_rules.create(
            :parent_group_id => security_group.id,
            :ip_protocol     => 'tcp',
            :from_port       => 1234,
            :to_port         => 1234,
            :ip_range        => { "cidr" => "0.0.0.0/0" }
          )
          rule.destroy
          returns(true) { rule.reload == nil }
        end
      end
    ensure
      security_group.destroy if security_group
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
fog-1.22.0 tests/openstack/models/compute/security_group_tests.rb
fog-1.21.0 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/openstack/models/compute/security_group_tests.rb
fog-1.20.0 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/openstack/models/compute/security_group_tests.rb
fog-1.19.0 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/openstack/models/compute/security_group_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/openstack/models/compute/security_group_tests.rb