diff options
| author | Artem Goncharov <artem.goncharov@gmail.com> | 2019-02-26 11:13:25 +0100 |
|---|---|---|
| committer | Artem Goncharov <artem.goncharov@gmail.com> | 2019-02-26 11:13:25 +0100 |
| commit | 444a40c656b9f6007364ecd3bcf38964bbcd4556 (patch) | |
| tree | 084765fddbc5d18a5093f384b8c1583779f7a0ad /openstackclient/tests/unit/image | |
| parent | 0a187905c01f6bc2b9855081ac0042f00715dedf (diff) | |
| download | python-openstackclient-444a40c656b9f6007364ecd3bcf38964bbcd4556.tar.gz | |
Add possibility to filter images using member_status
In order to see image sharing membership it is required to additionally
pass member_status filter to API. Otherwise only those with status 'all'
will be returned. Thus adding possibility to see images shared with
project to be approved or rejected.
Change-Id: Ifd6e13e5a4ef09fbc29e76d464c93fbdbb178ae4
Diffstat (limited to 'openstackclient/tests/unit/image')
| -rw-r--r-- | openstackclient/tests/unit/image/v2/test_image.py | 43 |
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', |
