aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests
diff options
context:
space:
mode:
authorAlen Mujezinovic2012-02-09 11:13:42 +0000
committerAlen Mujezinovic2012-02-09 11:13:42 +0000
commitadd5f32e8a9ba530591c23b8123f36468595fd88 (patch)
tree7d4794e487614c9928d5f31420dfb423350cbff6 /djangorestframework/tests
parentdd680d7a0ae997f2e562db383f23b56624e7ea98 (diff)
parentc5691cca0e5b61b6cf866f5b8085f950e4637f5a (diff)
downloaddjango-rest-framework-add5f32e8a9ba530591c23b8123f36468595fd88.tar.bz2
Merge remote branch 'tomchristie/master'
Diffstat (limited to 'djangorestframework/tests')
-rw-r--r--djangorestframework/tests/mixins.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/djangorestframework/tests/mixins.py b/djangorestframework/tests/mixins.py
index 88b13dd5..8268fdca 100644
--- a/djangorestframework/tests/mixins.py
+++ b/djangorestframework/tests/mixins.py
@@ -30,7 +30,7 @@ class TestModelRead(TestModelsTestCase):
mixin = ReadModelMixin()
mixin.resource = GroupResource
- response = mixin.get(request, group.id)
+ response = mixin.get(request, id=group.id)
self.assertEquals(group.name, response.name)
def test_read_404(self):
@@ -41,7 +41,7 @@ class TestModelRead(TestModelsTestCase):
mixin = ReadModelMixin()
mixin.resource = GroupResource
- self.assertRaises(ErrorResponse, mixin.get, request, 12345)
+ self.assertRaises(ErrorResponse, mixin.get, request, id=12345)
class TestModelCreation(TestModelsTestCase):
@@ -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'])