diff options
| author | Tom Christie | 2012-02-07 03:14:08 -0800 |
|---|---|---|
| committer | Tom Christie | 2012-02-07 03:14:08 -0800 |
| commit | 5b7c8658bada462996c23bd618add39d963e859f (patch) | |
| tree | 3061d8760cb92139a8867eace3b7860ecd838b37 /djangorestframework/tests/mixins.py | |
| parent | 0f49f9b2b5c4e36c6edbb9b135e5653bdec46ce2 (diff) | |
| parent | 76a7d35813b637bb199a0d388468f9265f8adaf2 (diff) | |
| download | django-rest-framework-5b7c8658bada462996c23bd618add39d963e859f.tar.bz2 | |
Merge pull request #156 from j4mie/duplicate-page-param
Ensure duplicate "page" parameters are not created
Diffstat (limited to 'djangorestframework/tests/mixins.py')
| -rw-r--r-- | djangorestframework/tests/mixins.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/djangorestframework/tests/mixins.py b/djangorestframework/tests/mixins.py index a7512efc..8268fdca 100644 --- a/djangorestframework/tests/mixins.py +++ b/djangorestframework/tests/mixins.py @@ -280,3 +280,12 @@ class TestPagination(TestCase): self.assertTrue('foo=bar' in content['next']) self.assertTrue('another=something' in content['next']) self.assertTrue('page=2' in content['next']) + + def test_duplicate_parameters_are_not_created(self): + """ Regression: ensure duplicate "page" parameters are not added to + paginated URLs. So page 1 should contain ?page=2, not ?page=1&page=2 """ + request = self.req.get('/paginator/?page=1') + response = MockPaginatorView.as_view()(request) + content = json.loads(response.content) + self.assertTrue('page=2' in content['next']) + self.assertFalse('page=1' in content['next']) |
