Here are the examples of the python api mock.sentinel.planned_vm taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
Project: os-win Source File: test_livemigrationutils.py
@ddt.data({'planned_vm': None}, {'planned_vm': mock.sentinel.planned_vm})
@ddt.unpack
@mock.patch.object(livemigrationutils.LiveMigrationUtils,
'_destroy_planned_vm')
@mock.patch.object(livemigrationutils.LiveMigrationUtils,
'_get_planned_vm')
def test_destroy_existing_planned_vm(self, mock_get_planned_vm,
mock_destroy_planned_vm, planned_vm):
mock_get_planned_vm.return_value = planned_vm
self.liveutils.destroy_existing_planned_vm(mock.sentinel.vm_name)
mock_get_planned_vm.assert_called_once_with(
mock.sentinel.vm_name, self._conn)
if planned_vm:
mock_destroy_planned_vm.assert_called_once_with(planned_vm)
else:
self.assertFalse(mock_destroy_planned_vm.called)
3
Example 2
Project: os-win Source File: test_migrationutils.py
@ddt.data([mock.sentinel.planned_vm], [])
def test_get_planned_vm(self, planned_vm):
planned_computer_system = (
self._migrationutils._conn.Msvm_PlannedComputerSystem)
planned_computer_system.return_value = planned_vm
actual_result = self._migrationutils._get_planned_vm(
self._FAKE_VM_NAME, fail_if_not_found=False)
if planned_vm:
self.assertEqual(planned_vm[0], actual_result)
else:
self.assertIsNone(actual_result)
planned_computer_system.assert_called_once_with(
ElementName=self._FAKE_VM_NAME)