diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-05-25 19:03:15 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-05-25 19:03:15 +0200 |
| commit | e73838b6ddcc7b37c03f9eee04fa6e6a283fedb3 (patch) | |
| tree | 08031fd77bbf72a54ebc9054de68a9e299934b20 /tests | |
| parent | 323b414441e13681c2a4117dc7043926f938f48a (diff) | |
Fixed #17371 -- Made the test client more flexible
The OPTIONS, PUT and DELETE methods no longer apply arbitrary
data encoding (in the query string or in the request body).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/conditional_processing/models.py | 4 | ||||
| -rw-r--r-- | tests/regressiontests/test_client_regress/models.py | 21 |
2 files changed, 6 insertions, 19 deletions
diff --git a/tests/regressiontests/conditional_processing/models.py b/tests/regressiontests/conditional_processing/models.py index f7f48bc9c8..97aeff5eaa 100644 --- a/tests/regressiontests/conditional_processing/models.py +++ b/tests/regressiontests/conditional_processing/models.py @@ -63,10 +63,10 @@ class ConditionalGet(TestCase): def testIfMatch(self): self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG - response = self.client.put('/condition/etag/', {'data': ''}) + response = self.client.put('/condition/etag/') self.assertEqual(response.status_code, 200) self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % EXPIRED_ETAG - response = self.client.put('/condition/etag/', {'data': ''}) + response = self.client.put('/condition/etag/') self.assertEqual(response.status_code, 412) def testBothHeaders(self): diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index 3fb8f894fd..ca55bd156b 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -347,7 +347,7 @@ class AssertRedirectsTests(TestCase): def test_redirect_chain_options(self): "A redirect chain will be followed from an initial OPTIONS request" response = self.client.options('/test_client_regress/redirects/', - {'nothing': 'to_send'}, follow=True) + follow=True) self.assertRedirects(response, '/test_client_regress/no_template_view/', 301, 200) self.assertEqual(len(response.redirect_chain), 3) @@ -355,7 +355,7 @@ class AssertRedirectsTests(TestCase): def test_redirect_chain_put(self): "A redirect chain will be followed from an initial PUT request" response = self.client.put('/test_client_regress/redirects/', - {'nothing': 'to_send'}, follow=True) + follow=True) self.assertRedirects(response, '/test_client_regress/no_template_view/', 301, 200) self.assertEqual(len(response.redirect_chain), 3) @@ -363,7 +363,7 @@ class AssertRedirectsTests(TestCase): def test_redirect_chain_delete(self): "A redirect chain will be followed from an initial DELETE request" response = self.client.delete('/test_client_regress/redirects/', - {'nothing': 'to_send'}, follow=True) + follow=True) self.assertRedirects(response, '/test_client_regress/no_template_view/', 301, 200) self.assertEqual(len(response.redirect_chain), 3) @@ -809,8 +809,7 @@ class RequestMethodStringDataTests(TestCase): class QueryStringTests(TestCase): def test_get_like_requests(self): # 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'): + for method_name in ('get', 'head'): # 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'}) @@ -867,9 +866,6 @@ 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" @@ -878,9 +874,6 @@ 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" @@ -889,9 +882,6 @@ 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" @@ -900,9 +890,6 @@ 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): |
