summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit/v2/test_shell_v2.py
diff options
context:
space:
mode:
authorErno Kuvaja <jokke@usr.fi>2019-12-18 09:57:30 +0000
committerAbhishek Kekane <akekane@redhat.com>2020-03-20 07:21:59 +0000
commitd91bcae8a509235ec17a60233e2c3e252b9a317d (patch)
treedddff4311e2444f8f5b36540911bab94b3ec8e3c /glanceclient/tests/unit/v2/test_shell_v2.py
parent6d506c3a3644cf79622238473c99d9c22cfd4e96 (diff)
downloadpython-glanceclient-d91bcae8a509235ec17a60233e2c3e252b9a317d.tar.gz
Delete image from specific store
Add support to delete image from specific store. bp: delete-from-store Change-Id: Ie57d7de5822264a5ea8a5f4587ab8cfb4afb79de
Diffstat (limited to 'glanceclient/tests/unit/v2/test_shell_v2.py')
-rw-r--r--glanceclient/tests/unit/v2/test_shell_v2.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py
index f137d30..c43f606 100644
--- a/glanceclient/tests/unit/v2/test_shell_v2.py
+++ b/glanceclient/tests/unit/v2/test_shell_v2.py
@@ -2166,6 +2166,29 @@ class ShellV2Test(testtools.TestCase):
mocked_utils_exit.assert_called_once_with()
@mock.patch.object(utils, 'exit')
+ def test_do_image_delete_from_store_not_found(self, mocked_utils_exit):
+ args = argparse.Namespace(id='image1', store='store1')
+ with mock.patch.object(self.gc.images,
+ 'delete_from_store') as mocked_delete:
+ mocked_delete.side_effect = exc.HTTPNotFound
+
+ test_shell.do_stores_delete(self.gc, args)
+
+ self.assertEqual(1, mocked_delete.call_count)
+ mocked_utils_exit.assert_called_once_with('Multi Backend support '
+ 'is not enabled or '
+ 'Image/store not found.')
+
+ def test_do_image_delete_from_store(self):
+ args = argparse.Namespace(id='image1', store='store1')
+ with mock.patch.object(self.gc.images,
+ 'delete_from_store') as mocked_delete:
+ test_shell.do_stores_delete(self.gc, args)
+
+ mocked_delete.assert_called_once_with('store1',
+ 'image1')
+
+ @mock.patch.object(utils, 'exit')
@mock.patch.object(utils, 'print_err')
def test_do_image_delete_with_forbidden_ids(self, mocked_print_err,
mocked_utils_exit):