| 30 | self.assertListEqual(list(itr), expected) |
| 31 | |
| 32 | def test_iter_paged(self): |
| 33 | expected = list(range(10)) |
| 34 | response_future = Mock(has_more_pages=True, _continuous_paging_session=None) |
| 35 | response_future.result.side_effect = (ResultSet(Mock(), expected[-5:]), ) # ResultSet is iterable, so it must be protected in order to be returned whole by the Mock |
| 36 | rs = ResultSet(response_future, expected[:5]) |
| 37 | itr = iter(rs) |
| 38 | # this is brittle, depends on internal impl details. Would like to find a better way |
| 39 | type(response_future).has_more_pages = PropertyMock(side_effect=(True, True, False)) # after init to avoid side effects being consumed by init |
| 40 | self.assertListEqual(list(itr), expected) |
| 41 | |
| 42 | def test_iter_paged_with_empty_pages(self): |
| 43 | expected = list(range(10)) |