Merge "mock utils.execute() in qemu-img unit test" into stable/pike

This commit is contained in:
Zuul 2018-06-29 14:30:59 +00:00 committed by Gerrit Code Review
commit b1ab231836
1 changed files with 5 additions and 1 deletions

View File

@ -30,8 +30,12 @@ class QemuTestCase(test.NoDBTestCase):
images.qemu_img_info,
'/path/that/does/not/exist')
@mock.patch.object(utils, 'execute')
@mock.patch.object(os.path, 'exists', return_value=True)
def test_qemu_info_with_errors(self, path_exists):
def test_qemu_info_with_errors(self, path_exists, mock_exec):
err = processutils.ProcessExecutionError(
exit_code=1, stderr='No such file or directory')
mock_exec.side_effect = err
self.assertRaises(exception.DiskNotFound,
images.qemu_img_info,
'/fake/path')