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) return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id): def is_resource_deleted(self, id):
# Added status check for user with admin role
try: try:
self.show_image(id) if self.show_image(id)['image']['status'] == 'DELETED':
return True
except lib_exc.NotFound: except lib_exc.NotFound:
return True return True
return False return False

View File

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

View File

@ -186,7 +186,7 @@ class TestImagesClient(base.BaseComputeServiceTest):
def _test_resource_deleted(self, bytes_body=False): def _test_resource_deleted(self, bytes_body=False):
params = {"id": self.FAKE_IMAGE_ID} 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' self.useFixture(mockpatch.Patch('tempest.lib.services.compute'
'.images_client.ImagesClient.show_image', '.images_client.ImagesClient.show_image',
side_effect=lib_exc.NotFound)) side_effect=lib_exc.NotFound))