From 581280386533f8780a8d2e73495d3eff38c9ad50 Mon Sep 17 00:00:00 2001 From: xiexs Date: Tue, 17 Nov 2015 05:16:09 -0500 Subject: Add limit option to "image list" command This option is quite useful if there are too many images. Change-Id: If6a901c27c5da2d1f4412e8fa9ba3bed3b72fdd9 Co-Authored-By: Tang Chen Partial-Bug: #1540988 --- openstackclient/tests/image/v2/test_image.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py index b02b3795..3e31d0ad 100644 --- a/openstackclient/tests/image/v2/test_image.py +++ b/openstackclient/tests/image/v2/test_image.py @@ -655,6 +655,23 @@ class TestImageList(TestImage): self.assertEqual(self.columns, columns) self.assertEqual(self.datalist, tuple(data)) + def test_image_list_limit_option(self): + arglist = [ + '--limit', str(1), + ] + verifylist = [ + ('limit', 1), + ] + 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( + limit=1, + ) + + self.assertEqual(self.columns, columns) + self.assertEqual(len(self.datalist), len(tuple(data))) + class TestRemoveProjectImage(TestImage): -- cgit v1.2.1