diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-08-23 00:52:45 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-08-23 00:52:45 +0000 |
| commit | d310f91ee7cb76db4d3dd2d1d2304a561cca3a29 (patch) | |
| tree | 4ff7785c566560f14b093cc38276a771f536e1bf /tests | |
| parent | 0f767f9a993f5834f7a2004bf4c440a126a73d06 (diff) | |
Fixed #10571 -- Factored out the payload encoding code to make sure it is used for PUT requests. Thanks to kennu for the report, pterk for the patch, and wildfire for the review comments.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16651 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/test_client_regress/models.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index 8e840e4982..18ffffde1a 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -770,7 +770,9 @@ class RequestMethodStringDataTests(TestCase): class QueryStringTests(TestCase): def test_get_like_requests(self): - for method_name in ('get','head','options','put','delete'): + # See: https://code.djangoproject.com/ticket/10571. + # Removed 'put' and 'delete' here as they are 'GET-like requests' + for method_name in ('get','head','options'): # A GET-like request can pass a query string as data method = getattr(self.client, method_name) response = method("/test_client_regress/request_data/", data={'foo':'whiz'}) @@ -827,6 +829,9 @@ class UnicodePayloadTests(TestCase): response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json") self.assertEqual(response.content, json) + response = self.client.put("/test_client_regress/parse_unicode_json/", json, + content_type="application/json") + self.assertEqual(response.content, json) def test_unicode_payload_utf8(self): "A non-ASCII unicode data encoded as UTF-8 can be POSTed" @@ -835,6 +840,9 @@ class UnicodePayloadTests(TestCase): response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=utf-8") self.assertEqual(response.content, json.encode('utf-8')) + response = self.client.put("/test_client_regress/parse_unicode_json/", json, + content_type="application/json; charset=utf-8") + self.assertEqual(response.content, json.encode('utf-8')) def test_unicode_payload_utf16(self): "A non-ASCII unicode data encoded as UTF-16 can be POSTed" @@ -843,6 +851,9 @@ class UnicodePayloadTests(TestCase): response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=utf-16") self.assertEqual(response.content, json.encode('utf-16')) + response = self.client.put("/test_client_regress/parse_unicode_json/", json, + content_type="application/json; charset=utf-16") + self.assertEqual(response.content, json.encode('utf-16')) def test_unicode_payload_non_utf(self): "A non-ASCII unicode data as a non-UTF based encoding can be POSTed" @@ -851,6 +862,9 @@ class UnicodePayloadTests(TestCase): response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=koi8-r") self.assertEqual(response.content, json.encode('koi8-r')) + response = self.client.put("/test_client_regress/parse_unicode_json/", json, + content_type="application/json; charset=koi8-r") + self.assertEqual(response.content, json.encode('koi8-r')) class DummyFile(object): def __init__(self, filename): |
