diff options
| author | Cyril Roelandt <cyril@redhat.com> | 2019-04-26 20:25:38 +0200 |
|---|---|---|
| committer | Cyril Roelandt <cyril@redhat.com> | 2022-06-07 20:22:34 +0200 |
| commit | 34d1e0c7eb8f4b613ca1f8e672a5367a4078a44a (patch) | |
| tree | 815aab37c516fd6b6201fc272a2465c3bc5c1494 /openstackclient/tests/unit/image | |
| parent | ed304992ebb8db97226a5f3496d20b7a20f93088 (diff) | |
| download | python-openstackclient-34d1e0c7eb8f4b613ca1f8e672a5367a4078a44a.tar.gz | |
Allow users to list all images
Add a "--all" option to "openstack image list", which allows the user to
list all of the images.
Story: 2010071
Change-Id: I56a2e4846d0380d07803305fb830d1a43dfd71b3
Diffstat (limited to 'openstackclient/tests/unit/image')
| -rw-r--r-- | openstackclient/tests/unit/image/v2/test_image.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py index d563bf50..444717a7 100644 --- a/openstackclient/tests/unit/image/v2/test_image.py +++ b/openstackclient/tests/unit/image/v2/test_image.py @@ -486,6 +486,7 @@ class TestImageList(TestImage): ('private', False), ('community', False), ('shared', False), + ('all', False), ('long', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -510,6 +511,7 @@ class TestImageList(TestImage): ('private', False), ('community', False), ('shared', False), + ('all', False), ('long', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -534,6 +536,7 @@ class TestImageList(TestImage): ('private', True), ('community', False), ('shared', False), + ('all', False), ('long', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -558,6 +561,7 @@ class TestImageList(TestImage): ('private', False), ('community', True), ('shared', False), + ('all', False), ('long', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -582,6 +586,7 @@ class TestImageList(TestImage): ('private', False), ('community', False), ('shared', True), + ('all', False), ('long', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -597,6 +602,31 @@ class TestImageList(TestImage): self.assertEqual(self.columns, columns) self.assertCountEqual(self.datalist, tuple(data)) + def test_image_list_all_option(self): + arglist = [ + '--all', + ] + verifylist = [ + ('public', False), + ('private', False), + ('community', False), + ('shared', False), + ('all', True), + ('long', False), + ] + 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.client.images.assert_called_with( + visibility='all', + ) + + self.assertEqual(self.columns, columns) + self.assertCountEqual(self.datalist, tuple(data)) + def test_image_list_shared_member_status_option(self): arglist = [ '--shared', @@ -607,6 +637,7 @@ class TestImageList(TestImage): ('private', False), ('community', False), ('shared', True), + ('all', False), ('long', False), ('member_status', 'all') ] @@ -634,6 +665,7 @@ class TestImageList(TestImage): ('private', False), ('community', False), ('shared', True), + ('all', False), ('long', False), ('member_status', 'all') ] |
