File: floating_ip_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 (59 lines) | stat: -rw-r--r-- 1,533 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require "test_helper"
require "helpers/network_helper"

describe "Fog::OpenStack::Network | floating_ip" do
  describe "success" do
    let (:instance) do
      network.floating_ips.create(
        :floating_network_id => 'f0000000-0000-0000-0000-000000000000'
      )
    end

    after do
      network.delete_floating_ip(instance.id)
    end

    it "#create" do
      instance.id.wont_be_nil
    end

    it "#update" do
      instance.port_id = 'p0000000-0000-0000-0000-000000000000'
      instance.update.port_id.must_equal "p0000000-0000-0000-0000-000000000000"
    end

    describe "#associate" do
      let(:port_id) { 'p0000000-0000-0000-0000-000000000000' }
      let(:fixed_ip_address) { '8.8.8.8' }
      let(:associate) { instance.associate(port_id, fixed_ip_address) }

      it "must match port_id" do
        associate.port_id.must_equal port_id
      end

      it "must match fixed_ip_address" do
        associate.fixed_ip_address.must_equal fixed_ip_address
      end
    end

    describe "#disassociate" do
      let(:fixed_ip_address) { '8.8.8.8' }
      let(:disassociate) { instance.disassociate(fixed_ip_address) }

      it "resets port_id" do
        disassociate.port_id.must_equal nil
      end

      it "resets fixed_ip_address" do
        disassociate.fixed_ip_address.must_equal nil
      end
    end

    it "#destroy" do
      instance = network.floating_ips.create(
        :floating_network_id => 'f0000000-0000-0000-0000-000000000000'
      )
      instance.destroy == true
    end
  end
end