diff options
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/functional/image/v2/test_image.py | 18 | ||||
| -rw-r--r-- | openstackclient/tests/unit/image/v2/test_image.py | 28 |
2 files changed, 46 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/image/v2/test_image.py b/openstackclient/tests/functional/image/v2/test_image.py index 8fadd200..a93fa8cb 100644 --- a/openstackclient/tests/functional/image/v2/test_image.py +++ b/openstackclient/tests/functional/image/v2/test_image.py @@ -51,6 +51,24 @@ class ImageTests(base.TestCase): [img['Name'] for img in json_output] ) + def test_image_list_with_name_filter(self): + json_output = json.loads(self.openstack( + 'image list --name ' + self.NAME + ' -f json' + )) + self.assertIn( + self.NAME, + [img['Name'] for img in json_output] + ) + + def test_image_list_with_status_filter(self): + json_output = json.loads(self.openstack( + 'image list ' + ' --status active -f json' + )) + self.assertIn( + 'active', + [img['Status'] for img in json_output] + ) + def test_image_attributes(self): """Test set, unset, show on attributes, tags and properties""" diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py index 65764e98..484a2bc6 100644 --- a/openstackclient/tests/unit/image/v2/test_image.py +++ b/openstackclient/tests/unit/image/v2/test_image.py @@ -750,6 +750,34 @@ class TestImageList(TestImage): marker=image_fakes.image_id, ) + def test_image_list_name_option(self): + arglist = [ + '--name', 'abc', + ] + verifylist = [ + ('name', 'abc'), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + self.api_mock.image_list.assert_called_with( + name='abc', marker=self._image.id + ) + + def test_image_list_status_option(self): + arglist = [ + '--status', 'active', + ] + verifylist = [ + ('status', 'active'), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + self.api_mock.image_list.assert_called_with( + status='active', marker=self._image.id + ) + class TestRemoveProjectImage(TestImage): |
