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

View differences:

src/oca/ruby/test/VirtualMachinePool_spec.rb
25 25
                    vm.name.should eql('vm-example')
26 26
                    vm.state.should eql(3)
27 27
                    vm.state_str.should eql('ACTIVE')
28
                    vm['UID'].should eql('0')
29
                    vm['USERNAME'].should eql('oneadmin')
30
                    vm['LAST_POLL'].should eql('1277910006')
31
                    vm['HISTORY/HOSTNAME'].should eql('dummyhost')
32
                    vm['HISTORY/STIME'].should eql('1277375186')
33
                    vm['HISTORY/REASON'].should eql('0')
28 34
                elsif vm.id == 8
29 35
                    vm.name.should eql('vmext')
30 36
                    vm.state.should eql(4)
31 37
                    vm.state_str.should eql('STOPPED')
38
                    vm['UID'].should eql('0')
39
                    vm['USERNAME'].should eql('oneadmin')
40
                    vm['LAST_POLL'].should eql('1277910006')
41
                    vm['HISTORY/HOSTNAME'].should eql('thost')
42
                    vm['HISTORY/STIME'].should eql('1277377556')
43
                    vm['HISTORY/REASON'].should eql('0')
32 44
                end
33 45
            }
34 46
        end
35
        
36
        it "should get a hash representation of the VM_POOL" do
37
            vm_hash = @vm_pool.to_hash
38
            vm_hash['VM_POOL']['VM'][0]['ID'].should eql('6')
39
            vm_hash['VM_POOL']['VM'][0]['UID'].should eql('0')
40
            vm_hash['VM_POOL']['VM'][0]['USERNAME'].should eql('oneadmin')
41
            vm_hash['VM_POOL']['VM'][0]['NAME'].should eql('vm-example')
42
            vm_hash['VM_POOL']['VM'][0]['LAST_POLL'].should eql('1277910006')
43
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['HOSTNAME'].should eql('dummyhost')
44
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['STIME'].should eql('1277375186')
45
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['REASON'].should eql('0')
46
            vm_hash['VM_POOL']['VM'][2]['ID'].should eql('8')
47
            vm_hash['VM_POOL']['VM'][2]['UID'].should eql('0')
48
            vm_hash['VM_POOL']['VM'][2]['USERNAME'].should eql('oneadmin')
49
            vm_hash['VM_POOL']['VM'][2]['NAME'].should eql('vmext')
50
            vm_hash['VM_POOL']['VM'][2]['LAST_POLL'].should eql('1277910006')
51
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['HOSTNAME'].should eql('thost')
52
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['STIME'].should eql('1277377556')
53
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['REASON'].should eql('0')
54
        end
55 47
    end
56 48
    
57 49
    describe "VirtualMachinePool using REXML" do
......
74 66
                    vm.name.should eql('vm-example')
75 67
                    vm.state.should eql(3)
76 68
                    vm.state_str.should eql('ACTIVE')
69
                    vm['UID'].should eql('0')
70
                    vm['USERNAME'].should eql('oneadmin')
71
                    vm['LAST_POLL'].should eql('1277910006')
72
                    vm['HISTORY/HOSTNAME'].should eql('dummyhost')
73
                    vm['HISTORY/STIME'].should eql('1277375186')
74
                    vm['HISTORY/REASON'].should eql('0')
77 75
                elsif vm.id == 8
78 76
                    vm.name.should eql('vmext')
79 77
                    vm.state.should eql(4)
80 78
                    vm.state_str.should eql('STOPPED')
79
                    vm['UID'].should eql('0')
80
                    vm['USERNAME'].should eql('oneadmin')
81
                    vm['LAST_POLL'].should eql('1277910006')
82
                    vm['HISTORY/HOSTNAME'].should eql('thost')
83
                    vm['HISTORY/STIME'].should eql('1277377556')
84
                    vm['HISTORY/REASON'].should eql('0')
81 85
                end
82 86
            }
83 87
        end
84
        
85
        it "should get a hash representation of the VM_POOL" do
86
            vm_hash = @vm_pool.to_hash
87
            vm_hash['VM_POOL']['VM'][0]['ID'].should eql('6')
88
            vm_hash['VM_POOL']['VM'][0]['UID'].should eql('0')
89
            vm_hash['VM_POOL']['VM'][0]['USERNAME'].should eql('oneadmin')
90
            vm_hash['VM_POOL']['VM'][0]['NAME'].should eql('vm-example')
91
            vm_hash['VM_POOL']['VM'][0]['LAST_POLL'].should eql('1277910006')
92
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['HOSTNAME'].should eql('dummyhost')
93
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['STIME'].should eql('1277375186')
94
            vm_hash['VM_POOL']['VM'][0]['HISTORY']['REASON'].should eql('0')
95
            vm_hash['VM_POOL']['VM'][2]['ID'].should eql('8')
96
            vm_hash['VM_POOL']['VM'][2]['UID'].should eql('0')
97
            vm_hash['VM_POOL']['VM'][2]['USERNAME'].should eql('oneadmin')
98
            vm_hash['VM_POOL']['VM'][2]['NAME'].should eql('vmext')
99
            vm_hash['VM_POOL']['VM'][2]['LAST_POLL'].should eql('1277910006')
100
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['HOSTNAME'].should eql('thost')
101
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['STIME'].should eql('1277377556')
102
            vm_hash['VM_POOL']['VM'][2]['HISTORY']['REASON'].should eql('0')
103
        end
104 88
    end
105 89
end

Also available in: Unified diff