diff --git a/os_win/tests/unit/utils/compute/test_migrationutils.py b/os_win/tests/unit/utils/compute/test_migrationutils.py index 4a308a93..89c8ab1b 100644 --- a/os_win/tests/unit/utils/compute/test_migrationutils.py +++ b/os_win/tests/unit/utils/compute/test_migrationutils.py @@ -114,7 +114,8 @@ class MigrationUtilsTestCase(test_base.OsWinBaseTestCase): mock.sentinel.job_path_ValidatePlannedSystem), mock.call(mock.sentinel.ret_val_RealizePlannedSystem, mock.sentinel.job_path_RealizePlannedSystem)] - self._migrationutils._jobutils.check_ret_val.has_calls(expected_call) + self._migrationutils._jobutils.check_ret_val.assert_has_calls( + expected_call) @ddt.data([mock.sentinel.planned_vm], []) def test_get_planned_vm(self, planned_vm): diff --git a/os_win/tests/unit/utils/compute/test_vmutils10.py b/os_win/tests/unit/utils/compute/test_vmutils10.py index 869bc70e..1b6d6f4f 100644 --- a/os_win/tests/unit/utils/compute/test_vmutils10.py +++ b/os_win/tests/unit/utils/compute/test_vmutils10.py @@ -212,13 +212,13 @@ class VMUtils10TestCase(test_base.OsWinBaseTestCase): sec_profile_serialization) expected_call = [ - mock.call(mock.sentinel.job_path_SetKeyProtector, - mock.sentinel.ret_val_SetKeyProtector), - mock.call(mock.sentinel.job_path_SetSecurityPolicy, - mock.sentinel.ret_val_SetSecurityPolicy), - mock.call(mock.sentinel.job_path_ModifySecuritySettings, - mock.sentinel.ret_val_ModifySecuritySettings)] - self._vmutils._jobutils.check_ret_val.has_calls(expected_call) + mock.call(mock.sentinel.ret_val_SetKeyProtector, + mock.sentinel.job_path_SetKeyProtector), + mock.call(mock.sentinel.ret_val_SetSecurityPolicy, + mock.sentinel.job_path_SetSecurityPolicy), + mock.call(mock.sentinel.ret_val_ModifySecuritySettings, + mock.sentinel.job_path_ModifySecuritySettings)] + self._vmutils._jobutils.check_ret_val.assert_has_calls(expected_call) self.assertTrue(security_profile.EncryptStateAndVmMigrationTraffic) self.assertTrue(security_profile.TpmEnabled) self.assertTrue(security_profile.ShieldingRequested) diff --git a/os_win/tests/unit/utils/test_hostutils10.py b/os_win/tests/unit/utils/test_hostutils10.py index 58281f25..4534ebb4 100644 --- a/os_win/tests/unit/utils/test_hostutils10.py +++ b/os_win/tests/unit/utils/test_hostutils10.py @@ -90,8 +90,8 @@ class HostUtils10TestCase(test_base.OsWinBaseTestCase): 'dev_id': mock_pci_dev.DeviceID} self.assertEqual([expected_pci_dev], pci_devices) self._hostutils._conn.Msvm_PciExpress.assert_called_once_with() - mock_get_pci_device_address.has_calls( - [mock.call(mock_pci_dev.DeviceInstancePath)] * 3) + mock_get_pci_device_address.assert_has_calls( + [mock.call(mock_pci_dev.DeviceInstancePath)] * 2) def _check_get_pci_device_address_None(self, return_code=0): pnp_device = mock.MagicMock() diff --git a/os_win/tests/unit/utils/test_jobutils.py b/os_win/tests/unit/utils/test_jobutils.py index bf80168c..e23b4552 100755 --- a/os_win/tests/unit/utils/test_jobutils.py +++ b/os_win/tests/unit/utils/test_jobutils.py @@ -252,8 +252,11 @@ class JobUtilsTestCase(test_base.OsWinBaseTestCase): mock_calls = [ mock.call(ResourceSettings=[mock.sentinel.res_data])] * num_calls - mock_svc.ModifyResourceSettings.has_calls(mock_calls) - mock_sleep.has_calls(mock.call(1) * num_calls) + mock_svc.ModifyResourceSettings.assert_has_calls(mock_calls) + if num_calls > 1: + mock_sleep.assert_has_calls([mock.call(1)] * (num_calls - 1)) + else: + mock_sleep.assert_not_called() def test_add_virt_resource(self): self._test_virt_method('AddResourceSettings', 3, 'add_virt_resource', diff --git a/os_win/tests/unit/utils/test_pathutils.py b/os_win/tests/unit/utils/test_pathutils.py index f337520a..08b71348 100644 --- a/os_win/tests/unit/utils/test_pathutils.py +++ b/os_win/tests/unit/utils/test_pathutils.py @@ -254,13 +254,8 @@ class PathUtilsTestCase(test_base.OsWinBaseTestCase): mock_delete.assert_called_once_with(mock.sentinel.temporary_file) @mock.patch.object(shutil, 'copytree') - @mock.patch('os.path.abspath') - def test_copy_dir(self, mock_abspath, mock_copytree): - mock_abspath.side_effect = [mock.sentinel.src, mock.sentinel.dest] + def test_copy_dir(self, mock_copytree): self._pathutils.copy_dir(mock.sentinel.src, mock.sentinel.dest) - - mock_abspath.has_calls( - [mock.call(mock.sentinel.src), mock.call(mock.sentinel.dest)]) mock_copytree.assert_called_once_with(mock.sentinel.src, mock.sentinel.dest)