Merge ""is_resource_deleted" fails to verify delete"

This commit is contained in:
Jenkins 2016-04-18 19:02:19 +00:00 committed by Gerrit Code Review
commit 326bbb4884
3 changed files with 6 additions and 3 deletions

View File

@ -131,8 +131,10 @@ class ImagesClient(base_compute_client.BaseComputeClient):
return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
# Added status check for user with admin role
try:
self.show_image(id)
if self.show_image(id)['image']['status'] == 'DELETED':
return True
except lib_exc.NotFound:
return True
return False

View File

@ -213,7 +213,8 @@ class ImagesClient(rest_client.RestClient):
def is_resource_deleted(self, id):
try:
self.get_image_meta(id)
if self.get_image_meta(id)['status'] == 'deleted':
return True
except lib_exc.NotFound:
return True
return False

View File

@ -186,7 +186,7 @@ class TestImagesClient(base.BaseComputeServiceTest):
def _test_resource_deleted(self, bytes_body=False):
params = {"id": self.FAKE_IMAGE_ID}
expected_op = self.FAKE_IMAGE_DATA['show']['image']
expected_op = self.FAKE_IMAGE_DATA['show']
self.useFixture(mockpatch.Patch('tempest.lib.services.compute'
'.images_client.ImagesClient.show_image',
side_effect=lib_exc.NotFound))