(self)
| 441 | } |
| 442 | |
| 443 | def test_first_offset(self): |
| 444 | request = Request(factory.get('/', {'limit': 5, 'offset': 5})) |
| 445 | queryset = self.paginate_queryset(request) |
| 446 | content = self.get_paginated_content(queryset) |
| 447 | context = self.get_html_context() |
| 448 | assert queryset == [6, 7, 8, 9, 10] |
| 449 | assert content == { |
| 450 | 'results': [6, 7, 8, 9, 10], |
| 451 | 'previous': 'http://testserver/?limit=5', |
| 452 | 'next': 'http://testserver/?limit=5&offset=10', |
| 453 | 'count': 100 |
| 454 | } |
| 455 | assert context == { |
| 456 | 'previous_url': 'http://testserver/?limit=5', |
| 457 | 'next_url': 'http://testserver/?limit=5&offset=10', |
| 458 | 'page_links': [ |
| 459 | PageLink('http://testserver/?limit=5', 1, False, False), |
| 460 | PageLink('http://testserver/?limit=5&offset=5', 2, True, False), |
| 461 | PageLink('http://testserver/?limit=5&offset=10', 3, False, False), |
| 462 | PAGE_BREAK, |
| 463 | PageLink('http://testserver/?limit=5&offset=95', 20, False, False), |
| 464 | ] |
| 465 | } |
| 466 | |
| 467 | def test_middle_offset(self): |
| 468 | request = Request(factory.get('/', {'limit': 5, 'offset': 10})) |
nothing calls this directly
no test coverage detected