Minor fix on mock migrated tests

Part of blueprint mock-framework-in-unit-tests

Change-Id: I40d18633889819e3087842e4fa9c7eccc2619c72
This commit is contained in:
Akihiro Motoki 2018-01-08 06:52:15 +09:00
parent d76e3ea5df
commit 51378f7058
2 changed files with 8 additions and 12 deletions

View File

@ -540,7 +540,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
class OwnerFilterTests(test.TestCase): class OwnerFilterTests(test.TestCase):
def setUp(self): def setUp(self):
super(OwnerFilterTests, self).setUp() super(OwnerFilterTests, self).setUp()
self.table = mock.Mock(sppec=horizon_tables.DataTable) self.table = mock.Mock(spec=horizon_tables.DataTable)
self.table.request = self.request self.table.request = self.request
@override_settings(IMAGES_LIST_FILTER_TENANTS=[{'name': 'Official', @override_settings(IMAGES_LIST_FILTER_TENANTS=[{'name': 'Official',

View File

@ -261,7 +261,7 @@ class ImagesAndSnapshotsUtilsTests(BaseImagesTestCase):
self.exceptions.glance, self.exceptions.glance,
[private_images, False, False], [private_images, False, False],
[shared_images, False, False], [shared_images, False, False],
] ]
images_cache = {} images_cache = {}
ret = utils.get_available_images(self.request, self.tenant.id, ret = utils.get_available_images(self.request, self.tenant.id,
@ -275,11 +275,9 @@ class ImagesAndSnapshotsUtilsTests(BaseImagesTestCase):
filters={'visibility': 'shared', 'status': 'active'}) filters={'visibility': 'shared', 'status': 'active'})
] ]
self.mock_image_list.assert_has_calls(image_calls) self.mock_image_list.assert_has_calls(image_calls)
handle_calls = [ mock_exception_handle.assert_called_once_with(
mock.call(test.IsHttpRequest(), test.IsHttpRequest(),
"Unable to retrieve public images."), "Unable to retrieve public images.")
]
mock_exception_handle.assert_has_calls(handle_calls)
expected_images = [image for image in private_images expected_images = [image for image in private_images
if image.container_format not in ('ami', 'aki')] if image.container_format not in ('ami', 'aki')]
@ -352,11 +350,9 @@ class ImagesAndSnapshotsUtilsTests(BaseImagesTestCase):
filters={'status': 'active', 'property-owner_id': '1'}) filters={'status': 'active', 'property-owner_id': '1'})
] ]
self.mock_image_list.assert_has_calls(image_calls) self.mock_image_list.assert_has_calls(image_calls)
handle_calls = [ mock_exception_handle.assert_called_once_with(
mock.call(test.IsHttpRequest(), test.IsHttpRequest(),
"Unable to retrieve images for the current project."), "Unable to retrieve images for the current project.")
]
mock_exception_handle.assert_has_calls(handle_calls)
class SeleniumTests(test.SeleniumTestCase): class SeleniumTests(test.SeleniumTestCase):