summaryrefslogtreecommitdiff
path: root/openstackclient/tests/image/v2
diff options
context:
space:
mode:
authorTerryHowe <terrylhowe@gmail.com>2015-04-14 11:03:22 -0600
committerTerryHowe <terrylhowe@gmail.com>2015-04-20 11:23:15 -0600
commit3c7b5185ca1eb89a00c54a57bb9ef028bcb290bb (patch)
treebc47050a52909f2ab4144aac70235ded830914a7 /openstackclient/tests/image/v2
parente60bf28ae3bdb34b65316249f0e7615048aa1f95 (diff)
downloadpython-openstackclient-3c7b5185ca1eb89a00c54a57bb9ef028bcb290bb.tar.gz
Handle the pagination for image list
Handle the paginatiion for image list. We were sorting the data here, so nothing lost for the generator. Change-Id: I2d7d4b3d5c9f650953f309c971ac53b64f6f7f77
Diffstat (limited to 'openstackclient/tests/image/v2')
-rw-r--r--openstackclient/tests/image/v2/test_image.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py
index 6a28b1ec..7eb23769 100644
--- a/openstackclient/tests/image/v2/test_image.py
+++ b/openstackclient/tests/image/v2/test_image.py
@@ -70,8 +70,8 @@ class TestImageList(TestImage):
super(TestImageList, self).setUp()
self.api_mock = mock.Mock()
- self.api_mock.image_list.return_value = [
- copy.deepcopy(image_fakes.IMAGE),
+ self.api_mock.image_list.side_effect = [
+ [copy.deepcopy(image_fakes.IMAGE)], [],
]
self.app.client_manager.image.api = self.api_mock
@@ -90,7 +90,9 @@ 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()
+ self.api_mock.image_list.assert_called_with(
+ marker=image_fakes.image_id,
+ )
collist = ('ID', 'Name')
@@ -117,6 +119,7 @@ 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,
)
collist = ('ID', 'Name')
@@ -144,6 +147,7 @@ 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,
)
collist = ('ID', 'Name')
@@ -171,6 +175,7 @@ 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,
)
collist = ('ID', 'Name')
@@ -193,7 +198,9 @@ 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()
+ self.api_mock.image_list.assert_called_with(
+ marker=image_fakes.image_id,
+ )
collist = (
'ID',
@@ -239,7 +246,9 @@ 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()
+ self.api_mock.image_list.assert_called_with(
+ marker=image_fakes.image_id,
+ )
sf_mock.assert_called_with(
[image_fakes.IMAGE],
attr='a',
@@ -268,7 +277,9 @@ 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()
+ self.api_mock.image_list.assert_called_with(
+ marker=image_fakes.image_id,
+ )
si_mock.assert_called_with(
[image_fakes.IMAGE],
'name:asc'