Merge "Changes in the new marker, initialise new marker to aviod bug."
This commit is contained in:
commit
a28f8e22fd
|
@ -856,6 +856,7 @@ class Resource(collections.MutableMapping):
|
|||
# less than our limit, we don't need to do an extra request
|
||||
# to get back an empty data set, which acts as a sentinel.
|
||||
yielded = 0
|
||||
new_marker = None
|
||||
for data in resp:
|
||||
value = cls.existing(**data)
|
||||
new_marker = value.id
|
||||
|
|
|
@ -814,6 +814,22 @@ class ResourceTests(base.TestTransportBase):
|
|||
self.assertEqual(session.get.call_count, len(pages))
|
||||
self.assertEqual(len(full_page + full_page + last_page), len(results))
|
||||
|
||||
def test_empty_list(self):
|
||||
page = []
|
||||
|
||||
session = mock.Mock()
|
||||
session.get = mock.Mock()
|
||||
full_response = mock.Mock()
|
||||
full_response.body = {FakeResource.resources_key: page}
|
||||
pages = [full_response]
|
||||
session.get.side_effect = pages
|
||||
|
||||
results = list(FakeResource.list(session, path_args=fake_arguments,
|
||||
paginated=True))
|
||||
|
||||
self.assertEqual(session.get.call_count, len(pages))
|
||||
self.assertEqual(len(page), len(results))
|
||||
|
||||
def test_attrs_name(self):
|
||||
obj = FakeResource()
|
||||
|
||||
|
|
Loading…
Reference in New Issue