| 61 | self.assertEqual(list(rs), expected) |
| 62 | |
| 63 | def test_list_paged(self): |
| 64 | # list access on RS for backwards-compatibility |
| 65 | expected = list(range(10)) |
| 66 | response_future = Mock(has_more_pages=True, _continuous_paging_session=None) |
| 67 | 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 |
| 68 | rs = ResultSet(response_future, expected[:5]) |
| 69 | # this is brittle, depends on internal impl details. Would like to find a better way |
| 70 | type(response_future).has_more_pages = PropertyMock(side_effect=(True, True, True, False)) # First two True are consumed on check entering list mode |
| 71 | self.assertEqual(rs[9], expected[9]) |
| 72 | self.assertEqual(list(rs), expected) |
| 73 | |
| 74 | def test_has_more_pages(self): |
| 75 | response_future = Mock() |