diff options
| author | Tom Christie | 2013-08-28 12:52:38 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-08-28 12:52:38 +0100 | 
| commit | 4c53fb883fe719c3ca6244aeb8c405a24eb89a40 (patch) | |
| tree | cf0079399de7e6381ac6b365a680ecb3fd3794d0 /rest_framework/tests | |
| parent | e1b54f2a2a078b3f1f9ba67f216d127b8182b100 (diff) | |
| download | django-rest-framework-4c53fb883fe719c3ca6244aeb8c405a24eb89a40.tar.bz2 | |
Tweak MAX_PAGINATE_BY behavior in edge case.
Always respect `paginate_by` settings if client does not specify page
size.  (Even if the developer has misconfigured, so that `paginate_by >
max`.)
Diffstat (limited to 'rest_framework/tests')
| -rw-r--r-- | rest_framework/tests/test_pagination.py | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/rest_framework/tests/test_pagination.py b/rest_framework/tests/test_pagination.py index cbed1604..4170d4b6 100644 --- a/rest_framework/tests/test_pagination.py +++ b/rest_framework/tests/test_pagination.py @@ -47,8 +47,8 @@ class MaxPaginateByView(generics.ListAPIView):      View for testing custom max_paginate_by usage      """      model = BasicModel -    paginate_by = 5 -    max_paginate_by = 3 +    paginate_by = 3 +    max_paginate_by = 5      paginate_by_param = 'page_size' @@ -343,16 +343,17 @@ class TestMaxPaginateByParam(TestCase):      def test_max_paginate_by(self):          """ -        If max_paginate_by is set and it less than paginate_by, new kwarg should limit requests for review. +        If max_paginate_by is set, it should limit page size for the view.          """          request = factory.get('/?page_size=10')          response = self.view(request).render()          self.assertEqual(response.data['count'], 13) -        self.assertEqual(response.data['results'], self.data[:3]) +        self.assertEqual(response.data['results'], self.data[:5])      def test_max_paginate_by_without_page_size_param(self):          """ -        If max_paginate_by is set, new kwarg should limit requests for review. +        If max_paginate_by is set, but client does not specifiy page_size, +        standard `paginate_by` behavior should be used.          """          request = factory.get('/')          response = self.view(request).render()  | 
