Glance image delete output

Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."

Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.

Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
This commit is contained in:
Abhishek Talwar
2014-12-11 14:54:03 +05:30
committed by Kamil Rykowski
parent 9829d7b6b9
commit f7cdc3eefe
4 changed files with 51 additions and 0 deletions
+12
View File
@@ -350,6 +350,18 @@ class ShellV2Test(testtools.TestCase):
mocked_delete.assert_called_once_with('pass')
def test_do_image_delete_deleted(self):
image_id = 'deleted-img'
args = self._make_args({'id': image_id})
with mock.patch.object(self.gc.images, 'get') as mocked_get:
mocked_get.return_value = self._make_args({'id': image_id,
'status': 'deleted'})
msg = "No image with an ID of '%s' exists." % image_id
self.assert_exits_with_msg(func=test_shell.do_image_delete,
func_args=args,
err_msg=msg)
def test_do_member_list(self):
args = self._make_args({'image_id': 'IMG-01'})
with mock.patch.object(self.gc.image_members, 'list') as mocked_list: