File: security_group_rules_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (36 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "test_helper"
require "helpers/network_helper"
require "helpers/collection_helper"

describe "Fog::OpenStack::Network | security_group_rules collection" do
  @secgroup   = network.security_groups.create(:name => "my_secgroup")
  attributes  = {:security_group_id => @secgroup.id, :direction => "ingress"}
  collection_tests(network.security_group_rules, attributes)

  describe "success" do
    before do
      @secgroup = network.security_groups.create(:name => "my_secgroup")

      @attributes = {
        :security_group_id => @secgroup.id,
        :direction         => "ingress",
        :protocol          => "tcp",
        :port_range_min    => 22,
        :port_range_max    => 22,
        :remote_ip_prefix  => "0.0.0.0/0"
      }

      @secgrouprule = network.security_group_rules.create(@attributes)
    end

    after do
      @secgroup.destroy
    end

    it "#all(filter)" do
      secgrouprule = network.security_group_rules.all(:direction => "ingress")
      secgrouprule.first.direction.must_equal "ingress"
      @secgrouprule.destroy
    end
  end
end