diff options
author | Alessandro Pilotti <ap@pilotti.it> | 2013-05-08 03:04:35 +0300 |
---|---|---|
committer | Alessandro Pilotti <ap@pilotti.it> | 2013-05-08 03:16:44 +0300 |
commit | eb8e070bf51fde5ad6ce98728ceeee0ffa5fd5a3 (patch) | |
tree | 16e3e12f17f27cac85fb951e49893e76fa1b8daa | |
parent | 7be2809c67aa0658d7d4c6666a754b5334d96c11 (diff) | |
download | nova-eb8e070bf51fde5ad6ce98728ceeee0ffa5fd5a3.tar.gz nova-eb8e070bf51fde5ad6ce98728ceeee0ffa5fd5a3.tar.xz nova-eb8e070bf51fde5ad6ce98728ceeee0ffa5fd5a3.zip |
Fixes mock calls in Hyper-V test method
Fixes bug: #1177605
This patch adds missing mocked calls to the test method
test_spawn_nova_net_vif_no_vswitch_exception implementation.
Change-Id: I115e2e081ef1273c78de1bba1414002d30eaa574
-rw-r--r-- | nova/tests/test_hypervapi.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/nova/tests/test_hypervapi.py b/nova/tests/test_hypervapi.py index 45466f783..dafe24235 100644 --- a/nova/tests/test_hypervapi.py +++ b/nova/tests/test_hypervapi.py @@ -861,6 +861,9 @@ class HyperVAPITestCase(test.TestCase): m.AndReturn(boot_from_volume) if not boot_from_volume: + m = fake.PathUtils.get_instance_dir(mox.Func(self._check_vm_name)) + m.AndReturn(self._test_instance_dir) + m = vhdutils.VHDUtils.get_vhd_info(mox.Func(self._check_img_path)) m.AndReturn({'MaxInternalSize': 1024}) @@ -883,10 +886,7 @@ class HyperVAPITestCase(test.TestCase): # TODO(alexpilotti) Based on where the exception is thrown # some of the above mock calls need to be skipped if with_exception: - m = vmutils.VMUtils.vm_exists(mox.Func(self._check_vm_name)) - m.AndReturn(True) - - vmutils.VMUtils.destroy_vm(mox.Func(self._check_vm_name)) + self._setup_destroy_mocks() else: vmutils.VMUtils.set_vm_state(mox.Func(self._check_vm_name), constants.HYPERV_VM_STATE_ENABLED) @@ -904,9 +904,6 @@ class HyperVAPITestCase(test.TestCase): config_drive=config_drive, use_cdrom=use_cdrom) - m = fake.PathUtils.get_instance_dir(mox.IsA(str)) - m.AndReturn(self._test_instance_dir) - self._mox.ReplayAll() self._spawn_instance(cow) self._mox.VerifyAll() |