summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-10-26 15:04:32 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-10-26 15:04:32 +0000
commitbf33627c63a475d1a1e0ee1400f4dc0e6cb2f076 (patch)
tree2213a3636bbfe4fe6d63939268f2f045e2f17425 /tests
parent0ed09c8a7308573e36dbcecb9bff3fcb3d7b02b8 (diff)
[1.1.X] Fixed #11371: Made `django.test.Client.put()` work for non-form-data PUT (i.e. JSON, etc.). Thanks, phyfus. Backport of [11656] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11657 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/test_client_regress/models.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
index be2cb8fa37..58693cc395 100644
--- a/tests/regressiontests/test_client_regress/models.py
+++ b/tests/regressiontests/test_client_regress/models.py
@@ -574,6 +574,23 @@ class RequestMethodTests(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, 'request method: DELETE')
+class RequestMethodStringDataTests(TestCase):
+ def test_post(self):
+ "Request a view with string data via request method POST"
+ # Regression test for #11371
+ data = u'{"test": "json"}'
+ response = self.client.post('/test_client_regress/request_methods/', data=data, content_type='application/json')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.content, 'request method: POST')
+
+ def test_put(self):
+ "Request a view with string data via request method PUT"
+ # Regression test for #11371
+ data = u'{"test": "json"}'
+ response = self.client.put('/test_client_regress/request_methods/', data=data, content_type='application/json')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.content, 'request method: PUT')
+
class QueryStringTests(TestCase):
def test_get_like_requests(self):
for method_name in ('get','head','options','put','delete'):