示例#1
0
    def test_migrate(self):
        '''
            Test to migrates the virtual machine to another hypervisor
        '''
        with patch.object(xapi, "_get_xapi_session", MagicMock()):
            mock = MagicMock(side_effect=[False, ["a", "b", "c"]])
            with patch.object(xapi, "_get_label_uuid", mock):
                self.assertFalse(xapi.migrate("salt", "stack"))

                self.assertTrue(xapi.migrate("salt", "stack"))

        with patch.object(xapi, "_check_xenapi",
                          MagicMock(return_value=Mockxapi)):
            mock = MagicMock(return_value=True)
            with patch.dict(xapi.__salt__, {'config.option': mock}):
                with patch.object(xapi, "_get_label_uuid", mock):
                    self.assertFalse(xapi.migrate("salt", "stack"))
示例#2
0
    def test_migrate(self):
        '''
            Test to migrates the virtual machine to another hypervisor
        '''
        with patch.object(xapi, "_get_xapi_session", MagicMock()):
            mock = MagicMock(side_effect=[False, ["a", "b", "c"]])
            with patch.object(xapi, "_get_label_uuid", mock):
                self.assertFalse(xapi.migrate("salt", "stack"))

                self.assertTrue(xapi.migrate("salt", "stack"))

        with patch.object(xapi, "_check_xenapi",
                          MagicMock(return_value=Mockxapi)):
            mock = MagicMock(return_value=True)
            with patch.dict(xapi.__salt__, {'config.option': mock}):
                with patch.object(xapi, "_get_label_uuid", mock):
                    self.assertFalse(xapi.migrate("salt", "stack"))