diff --git a/botocore/paginate.py b/botocore/paginate.py index 6b9abf28ea..19872b9faf 100644 --- a/botocore/paginate.py +++ b/botocore/paginate.py @@ -212,7 +212,15 @@ def build_full_result(self): for result_expression in self.result_keys: set_value_from_jmespath(complete_result, result_expression.expression, []) - for _, page in self: + for response in self: + page = response + # We want to try to catch operation object pagination + # and format correctly for those. They come in the form + # of a tuple of two elements: (http_response, parsed_responsed). + # We want the parsed_response as that is what the page iterator + # uses. We can remove it though once operation objects are removed. + if isinstance(response, tuple) and len(response) == 2: + page = response[1] # We're incrementally building the full response page # by page. For each page in the response we need to # inject the necessary components from the page diff --git a/tests/unit/test_paginate.py b/tests/unit/test_paginate.py index 8731aa9227..d9ecfdf031 100644 --- a/tests/unit/test_paginate.py +++ b/tests/unit/test_paginate.py @@ -183,6 +183,17 @@ def test_with_page_size(self): mock.call(Marker='m2', MaxKeys=1)] ) + def test_build_full_result_with_single_key(self): + responses = [ + {"Users": ["User1"], "Marker": "m1"}, + {"Users": ["User2"], "Marker": "m2"}, + {"Users": ["User3"]} + ] + self.method.side_effect = responses + pages = self.paginator.paginate() + complete = pages.build_full_result() + self.assertEqual(complete, {'Users': ['User1', 'User2', 'User3']}) + class TestPaginatorObjectConstruction(unittest.TestCase): def test_pagination_delegates_to_paginator(self):