diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-02-03 11:34:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-02-03 11:34:19 +0000 |
| commit | 34e4e1ac3e86fb698fc5e33bc7222a22338cbe3c (patch) | |
| tree | 769017ded6506d8619433d775b4abd9e4e928957 /openstackclient | |
| parent | e0969655ac8257760e4afdadebf568b86a0ae2b3 (diff) | |
| parent | 0b6fdcbe4c3f3142fdd18bfd827653d894607941 (diff) | |
| download | python-openstackclient-34e4e1ac3e86fb698fc5e33bc7222a22338cbe3c.tar.gz | |
Merge "Remove marker and loop from "image list" command"
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/image/v2/image.py | 11 | ||||
| -rw-r--r-- | openstackclient/tests/image/v2/test_image.py | 19 |
2 files changed, 5 insertions, 25 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 39a53195..842c6f20 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -474,16 +474,7 @@ class ListImage(command.Lister): column_headers = columns # List of image data received - data = [] - # No pages received yet, so start the page marker at None. - marker = None - while True: - page = image_client.api.image_list(marker=marker, **kwargs) - if not page: - break - data.extend(page) - # Set the marker to the id of the last item we received - marker = page[-1]['id'] + data = image_client.api.image_list(**kwargs) if parsed_args.property: # NOTE(dtroyer): coerce to a list to subscript it in py3 diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py index 41abdaab..b02b3795 100644 --- a/openstackclient/tests/image/v2/test_image.py +++ b/openstackclient/tests/image/v2/test_image.py @@ -498,9 +498,7 @@ class TestImageList(TestImage): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.api_mock.image_list.assert_called_with( - marker=image_fakes.image_id, - ) + self.api_mock.image_list.assert_called_with() self.assertEqual(self.columns, columns) self.assertEqual(self.datalist, tuple(data)) @@ -521,7 +519,6 @@ class TestImageList(TestImage): columns, data = self.cmd.take_action(parsed_args) self.api_mock.image_list.assert_called_with( public=True, - marker=image_fakes.image_id, ) self.assertEqual(self.columns, columns) @@ -543,7 +540,6 @@ class TestImageList(TestImage): columns, data = self.cmd.take_action(parsed_args) self.api_mock.image_list.assert_called_with( private=True, - marker=image_fakes.image_id, ) self.assertEqual(self.columns, columns) @@ -565,7 +561,6 @@ class TestImageList(TestImage): columns, data = self.cmd.take_action(parsed_args) self.api_mock.image_list.assert_called_with( shared=True, - marker=image_fakes.image_id, ) self.assertEqual(self.columns, columns) @@ -582,9 +577,7 @@ class TestImageList(TestImage): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.api_mock.image_list.assert_called_with( - marker=image_fakes.image_id, - ) + self.api_mock.image_list.assert_called_with() collist = ( 'ID', @@ -630,9 +623,7 @@ class TestImageList(TestImage): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.api_mock.image_list.assert_called_with( - marker=image_fakes.image_id, - ) + self.api_mock.image_list.assert_called_with() sf_mock.assert_called_with( [image_fakes.IMAGE], attr='a', @@ -655,9 +646,7 @@ class TestImageList(TestImage): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.api_mock.image_list.assert_called_with( - marker=image_fakes.image_id, - ) + self.api_mock.image_list.assert_called_with() si_mock.assert_called_with( [image_fakes.IMAGE], 'name:asc' |
