Merge ""is_resource_deleted" fails to verify delete"
This commit is contained in:
commit
326bbb4884
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user