Merge "Add v2 support for the marker attribute"

This commit is contained in:
Jenkins 2015-06-22 04:52:27 +00:00 committed by Gerrit Code Review
commit cc38f51086
2 changed files with 9 additions and 0 deletions

View File

@ -555,6 +555,12 @@ class TestController(testtools.TestCase):
self.assertEqual('image-3', images[2].name)
self.assertEqual(3, len(images))
def test_list_images_with_marker(self):
images = list(self.controller.list(limit=1,
marker='3a4560a1-e585-443e-9b39-553b46ec92d1'))
self.assertEqual('6f99bf80-2ee6-47cf-acfe-1f1fabb7e810', images[0].id)
self.assertEqual('image-2', images[0].name)
def test_list_images_visibility_public(self):
filters = {'filters': {'visibility': 'public'}}
images = list(self.controller.list(**filters))

View File

@ -168,6 +168,9 @@ class Controller(object):
for dir in sort_dir:
url = '%s&sort_dir=%s' % (url, dir)
if isinstance(kwargs.get('marker'), six.string_types):
url = '%s&marker=%s' % (url, kwargs['marker'])
for image in paginate(url, page_size, limit):
yield image