Merge "Fix imageutils tests on windows"

This commit is contained in:
Zuul 2017-11-03 20:45:09 +00:00 committed by Gerrit Code Review
commit 3a896f265c
1 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,7 @@ from cinder.volume import throttling
class TestQemuImgInfo(test.TestCase):
@mock.patch('os.name', new='posix')
@mock.patch('oslo_utils.imageutils.QemuImgInfo')
@mock.patch('cinder.utils.execute')
def test_qemu_img_info(self, mock_exec, mock_info):
@ -45,6 +46,7 @@ class TestQemuImgInfo(test.TestCase):
prlimit=image_utils.QEMU_IMG_LIMITS)
self.assertEqual(mock_info.return_value, output)
@mock.patch('os.name', new='posix')
@mock.patch('oslo_utils.imageutils.QemuImgInfo')
@mock.patch('cinder.utils.execute')
def test_qemu_img_info_not_root(self, mock_exec, mock_info):
@ -1475,6 +1477,9 @@ class TestVhdUtils(test.TestCase):
mock.sentinel.fourth,
mock.sentinel.fifth)
# os.path.join does not work with MagicMock objects on Windows.
mock_temp.return_value.__enter__.return_value = 'fake_temp_dir'
output = image_utils.coalesce_chain(vhd_chain)
self.assertEqual(mock.sentinel.fifth, output)