From d610d150f1f2bceb7769c15c0214567870013a41 Mon Sep 17 00:00:00 2001 From: Artem Muterko Date: Tue, 31 Jan 2017 16:51:09 +0200 Subject: [PATCH] Add test for pagination when limit not set --- tests/test_pagination.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 9f2e1c57c..dd7f70330 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -370,6 +370,13 @@ class TestLimitOffset: assert self.pagination.display_page_controls assert isinstance(self.pagination.to_html(), type('')) + def test_pagination_not_applied_if_limit_or_default_limit_not_set(self): + class MockPagination(pagination.LimitOffsetPagination): + default_limit = None + request = Request(factory.get('/')) + queryset = MockPagination().paginate_queryset(self.queryset, request) + assert queryset is None + def test_single_offset(self): """ When the offset is not a multiple of the limit we get some edge cases: