Revision c6c217d4 src/oca/ruby/test/VirtualNetworkPool_spec.rb

View differences:

src/oca/ruby/test/VirtualNetworkPool_spec.rb
28 28
                vn.class.to_s.should eql("OpenNebula::VirtualNetwork")
29 29
                if vn.id == 4
30 30
                    vn.name.should eql('Red LAN')
31
                    vn['UID'].should eql('0')
32
                    vn['USERNAME'].should eql('oneadmin')
33
                    vn['TYPE'].should eql('0')
34
                    vn['BRIDGE'].should eql('vbr0')
35
                    vn['TOTAL_LEASES'].should eql('0')
31 36
                elsif vn.id == 5
32 37
                    vn.name.should eql('Public')
38
                    vn['UID'].should eql('0')
39
                    vn['USERNAME'].should eql('oneadmin')
40
                    vn['TYPE'].should eql('0')
41
                    vn['BRIDGE'].should eql('vbr0')
42
                    vn['TOTAL_LEASES'].should eql('1')
33 43
                end
34 44
            }
35 45
        end
36
        
37
        it "should get a hash representation of the VNET_POOL" do
38
            vnet_hash = @vnet_pool.to_hash
39
            vnet_hash['VNET_POOL']['VNET'][0]['ID'].should eql('4')
40
            vnet_hash['VNET_POOL']['VNET'][0]['UID'].should eql('0')
41
            vnet_hash['VNET_POOL']['VNET'][0]['USERNAME'].should eql('oneadmin')
42
            vnet_hash['VNET_POOL']['VNET'][0]['NAME'].should eql('Red LAN')
43
            vnet_hash['VNET_POOL']['VNET'][0]['TYPE'].should eql('0')
44
            vnet_hash['VNET_POOL']['VNET'][0]['BRIDGE'].should eql('vbr0')
45
            vnet_hash['VNET_POOL']['VNET'][0]['TOTAL_LEASES'].should eql('0')
46
            vnet_hash['VNET_POOL']['VNET'][1]['ID'].should eql('5')
47
            vnet_hash['VNET_POOL']['VNET'][1]['UID'].should eql('0')
48
            vnet_hash['VNET_POOL']['VNET'][1]['USERNAME'].should eql('oneadmin')
49
            vnet_hash['VNET_POOL']['VNET'][1]['NAME'].should eql('Public')
50
            vnet_hash['VNET_POOL']['VNET'][1]['TYPE'].should eql('0')
51
            vnet_hash['VNET_POOL']['VNET'][1]['BRIDGE'].should eql('vbr0')
52
            vnet_hash['VNET_POOL']['VNET'][1]['TOTAL_LEASES'].should eql('1')
53
        end
54 46
    end
55 47
    
56 48
    describe "VirtualNetwork using REXML" do
......
76 68
                vn.class.to_s.should eql("OpenNebula::VirtualNetwork")
77 69
                if vn.id == 4
78 70
                    vn.name.should eql('Red LAN')
71
                    vn['UID'].should eql('0')
72
                    vn['USERNAME'].should eql('oneadmin')
73
                    vn['TYPE'].should eql('0')
74
                    vn['BRIDGE'].should eql('vbr0')
75
                    vn['TOTAL_LEASES'].should eql('0')
79 76
                elsif vn.id == 5
80 77
                    vn.name.should eql('Public')
78
                    vn['UID'].should eql('0')
79
                    vn['USERNAME'].should eql('oneadmin')
80
                    vn['TYPE'].should eql('0')
81
                    vn['BRIDGE'].should eql('vbr0')
82
                    vn['TOTAL_LEASES'].should eql('1')
81 83
                end
82 84
            }
83 85
        end
84
        
85
        it "should get a hash representation of the VNET_POOL" do
86
            vnet_hash = @vnet_pool.to_hash
87
            vnet_hash['VNET_POOL']['VNET'][0]['ID'].should eql('4')
88
            vnet_hash['VNET_POOL']['VNET'][0]['UID'].should eql('0')
89
            vnet_hash['VNET_POOL']['VNET'][0]['USERNAME'].should eql('oneadmin')
90
            vnet_hash['VNET_POOL']['VNET'][0]['NAME'].should eql('Red LAN')
91
            vnet_hash['VNET_POOL']['VNET'][0]['TYPE'].should eql('0')
92
            vnet_hash['VNET_POOL']['VNET'][0]['BRIDGE'].should eql('vbr0')
93
            vnet_hash['VNET_POOL']['VNET'][0]['TOTAL_LEASES'].should eql('0')
94
            vnet_hash['VNET_POOL']['VNET'][1]['ID'].should eql('5')
95
            vnet_hash['VNET_POOL']['VNET'][1]['UID'].should eql('0')
96
            vnet_hash['VNET_POOL']['VNET'][1]['USERNAME'].should eql('oneadmin')
97
            vnet_hash['VNET_POOL']['VNET'][1]['NAME'].should eql('Public')
98
            vnet_hash['VNET_POOL']['VNET'][1]['TYPE'].should eql('0')
99
            vnet_hash['VNET_POOL']['VNET'][1]['BRIDGE'].should eql('vbr0')
100
            vnet_hash['VNET_POOL']['VNET'][1]['TOTAL_LEASES'].should eql('1')
101
        end
102 86
    end
103 87
end

Also available in: Unified diff