summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorokozachenko <okozachenko@vexxhost.com>2020-12-10 20:22:55 +0200
committerokozachenko <okozachenko@vexxhost.com>2020-12-15 00:45:30 +0200
commit3c80b1b3b29307381b869f6a767e14e9d47e212f (patch)
treeaf1db607c3343dc1add1445137bc50bf2a1bdd5b /openstackclient/tests
parentf5b185c35728025ebfd4145c800648b34476b775 (diff)
downloadpython-openstackclient-3c80b1b3b29307381b869f6a767e14e9d47e212f.tar.gz
Add project field in image list subcommand
The motivation is to filter the image by owner Change-Id: I1f08da175a06e62a844f76b0ec18cb3332efef86
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/image/v2/test_image.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py
index b72e9835..ebeb8353 100644
--- a/openstackclient/tests/unit/image/v2/test_image.py
+++ b/openstackclient/tests/unit/image/v2/test_image.py
@@ -769,6 +769,21 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(ret_limit, len(tuple(data)))
+ def test_image_list_project_option(self):
+ self.client.find_image = mock.Mock(return_value=self._image)
+ arglist = [
+ '--project', 'nova',
+ ]
+ verifylist = [
+ ('project', 'nova'),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.assertEqual(self.columns, columns)
+ self.assertItemsEqual(self.datalist, tuple(data))
+
@mock.patch('osc_lib.utils.find_resource')
def test_image_list_marker_option(self, fr_mock):
# tangchen: Since image_fakes.IMAGE is a dict, it cannot offer a .id