mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 14:24:48 +03:00
Added test for limit=0 when using LimitOffsetPagination
This commit is contained in:
parent
6284bceaaf
commit
0429201ddb
|
@ -481,6 +481,21 @@ class TestLimitOffset:
|
|||
assert content.get('next') == next_url
|
||||
assert content.get('previous') == prev_url
|
||||
|
||||
def test_limit_is_zero(self):
|
||||
"""
|
||||
A limit of zero should produce an empty queryset without Exceptions and
|
||||
otherwise favor the defaults.
|
||||
"""
|
||||
request = Request(factory.get('/', {'limit': '0', 'offset': 0}))
|
||||
queryset = self.paginate_queryset(request)
|
||||
content = self.get_paginated_content(queryset)
|
||||
context = self.get_html_context()
|
||||
next_limit = self.pagination.default_limit
|
||||
next_offset = self.pagination.default_limit
|
||||
next_url = 'http://testserver/?limit={0}&offset={1}'.format(next_limit, next_offset)
|
||||
assert queryset == []
|
||||
assert content.get('next') == next_url
|
||||
|
||||
|
||||
class TestCursorPagination:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user