summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-07 00:34:17 +0000
committerGerrit Code Review <review@openstack.org>2019-03-07 00:34:17 +0000
commit8159fc216db779e5f14db24d9224f01265f1c7b2 (patch)
tree2131bc2d162abe3988b1482103bf305c611ce472 /openstackclient/tests/unit
parent1d16eed45a75957e56908e62e1a0cb899853349b (diff)
parent444a40c656b9f6007364ecd3bcf38964bbcd4556 (diff)
downloadpython-openstackclient-8159fc216db779e5f14db24d9224f01265f1c7b2.tar.gz
Merge "Add possibility to filter images using member_status"
Diffstat (limited to 'openstackclient/tests/unit')
-rw-r--r--openstackclient/tests/unit/image/v2/test_image.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py
index 170a7f03..087d8751 100644
--- a/openstackclient/tests/unit/image/v2/test_image.py
+++ b/openstackclient/tests/unit/image/v2/test_image.py
@@ -644,6 +644,49 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, tuple(data))
+ def test_image_list_shared_member_status_option(self):
+ arglist = [
+ '--shared',
+ '--member-status', 'all'
+ ]
+ verifylist = [
+ ('public', False),
+ ('private', False),
+ ('community', False),
+ ('shared', True),
+ ('long', False),
+ ('member_status', 'all')
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # In base command class Lister in cliff, abstract method take_action()
+ # returns a tuple containing the column names and an iterable
+ # containing the data to be listed.
+ columns, data = self.cmd.take_action(parsed_args)
+ self.api_mock.image_list.assert_called_with(
+ shared=True,
+ member_status='all',
+ marker=self._image.id,
+ )
+
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.datalist, tuple(data))
+
+ def test_image_list_shared_member_status_lower(self):
+ arglist = [
+ '--shared',
+ '--member-status', 'ALl'
+ ]
+ verifylist = [
+ ('public', False),
+ ('private', False),
+ ('community', False),
+ ('shared', True),
+ ('long', False),
+ ('member_status', 'all')
+ ]
+ self.check_parser(self.cmd, arglist, verifylist)
+
def test_image_list_long_option(self):
arglist = [
'--long',