Пример #1
0
 def test_update_vm_raise_runtime_fault(self):
     exception = vmodl.RuntimeFault()
     exception.msg = 'vmodl.RuntimeFault'
     self.mock_vm_ref.ReconfigVM_Task = MagicMock(side_effect=exception)
     with self.assertRaises(VMwareRuntimeError) as exc:
         vmware.update_vm(self.mock_vm_ref, self.mock_config_spec)
     self.assertEqual(exc.exception.strerror, 'vmodl.RuntimeFault')
Пример #2
0
 def test_update_vm_wait_for_task(self):
     mock_wait_for_task = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                MagicMock(return_value='my_vm')):
         with patch('salt.utils.vmware.wait_for_task', mock_wait_for_task):
             vmware.update_vm(self.mock_vm_ref, self.mock_config_spec)
     mock_wait_for_task.assert_called_once_with(self.mock_task, 'my_vm',
                                                'ReconfigureVM Task')
Пример #3
0
 def test_update_vm_task_call(self):
     vmware.update_vm(self.mock_vm_ref, self.mock_config_spec)
     self.mock_vm_update_task.assert_called_once()