summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-02 01:15:25 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-03 14:04:50 +0800
commit499369329c493f9734248393ff19a82b5e224078 (patch)
treedaf96200c419209314d485be0cfbacada85eaab6 /openstackclient/tests
parent581280386533f8780a8d2e73495d3eff38c9ad50 (diff)
downloadpython-openstackclient-499369329c493f9734248393ff19a82b5e224078.tar.gz
Add --marker option to "image list" command
Users could specify the last image (name or ID) of the previous page with --marker option to control the start image of the output. Change-Id: Idca0235ee83b1226b00c89cf3d38500fa898b7d0 Closes-Bug: #1540988
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/image/v2/test_image.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py
index 3e31d0ad..d399c9ed 100644
--- a/openstackclient/tests/image/v2/test_image.py
+++ b/openstackclient/tests/image/v2/test_image.py
@@ -672,6 +672,27 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(len(self.datalist), len(tuple(data)))
+ @mock.patch('openstackclient.common.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
+ # operation. Will fix this by using FakeImage class instead
+ # of IMAGE dict.
+ fr_mock.return_value = mock.Mock()
+ fr_mock.return_value.id = image_fakes.image_id
+
+ arglist = [
+ '--marker', image_fakes.image_name,
+ ]
+ verifylist = [
+ ('marker', image_fakes.image_name),
+ ]
+ 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(
+ marker=image_fakes.image_id,
+ )
+
class TestRemoveProjectImage(TestImage):