File: security_group_rule_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 (37 lines) | stat: -rw-r--r-- 1,060 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
37
require "test_helper"
require "helpers/network_helper"
require "helpers/model_helper"

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

  describe "success" do
    before do
      @secgroup = network.security_groups.create(:name => "fogsecgroup")
      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)
      @secgrouprule.wait_for { ready? } unless Fog.mocking?
    end

    after do
      @secgroup.destroy
    end

    it "#create" do
      @secgrouprule.id.wont_be_nil
    end

    it "#destroy" do
      @secgrouprule.destroy.must_equal true
    end
  end
end