def test_second_page(self):
request = testing.DummyRequest()
request.params['page'] = 2
request.current_route_url = mock.Mock(side_effect=self.get_current_url)
queryset = self.paginate_queryset(request)
content = self.get_paginated_content(queryset)
assert queryset == [6, 7, 8, 9, 10]
assert content == {
'results': [6, 7, 8, 9, 10],
'previous': 'http://testserver/',
'next': 'http://testserver/?page=3',
'count': 100
}
test_pagination.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录