示例#1
0
    def test_vm_state(self):
        '''
            Test to return list of all the vms and their state.
        '''
        with patch.object(xapi, "_get_xapi_session", MagicMock()):
            mock = MagicMock(return_value={"power_state": "1"})
            with patch.object(xapi, "_get_record_by_label", mock):
                self.assertDictEqual(xapi.vm_state("salt"), {'salt': '1'})

                self.assertDictEqual(xapi.vm_state(), {})
示例#2
0
    def test_vm_state(self):
        '''
            Test to return list of all the vms and their state.
        '''
        with patch.object(xapi, "_get_xapi_session", MagicMock()):
            mock = MagicMock(return_value={"power_state": "1"})
            with patch.object(xapi, "_get_record_by_label", mock):
                self.assertDictEqual(xapi.vm_state("salt"), {'salt': '1'})

                self.assertDictEqual(xapi.vm_state(), {})