diff options
| author | Julien Phalip <jphalip@gmail.com> | 2013-02-02 18:22:40 -0800 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2013-02-02 18:22:40 -0800 |
| commit | 293f7a21147ad94c92c7d5b3f33cbab2f87b001b (patch) | |
| tree | 43e1539dbf406d29782c5fffe85db25a3945ac24 /tests | |
| parent | 08dc90bccf7c4ffa8b04064d74b54c1150af5ff9 (diff) | |
Fixed #17797 -- Enabled support for PATCH requests in the dummy test client. Thanks to pfarmer for the suggestion and initial patch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/test_client_regress/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/test_client_regress/tests.py b/tests/regressiontests/test_client_regress/tests.py index 5ba5d3c4b3..c52715239b 100644 --- a/tests/regressiontests/test_client_regress/tests.py +++ b/tests/regressiontests/test_client_regress/tests.py @@ -783,6 +783,13 @@ class RequestMethodTests(TestCase): self.assertEqual(response.status_code, 200) self.assertEqual(response.content, b'request method: DELETE') + def test_patch(self): + "Request a view via request method PATCH" + response = self.client.patch('/test_client_regress/request_methods/') + self.assertEqual(response.status_code, 200) + self.assertEqual(response.content, b'request method: PATCH') + + class RequestMethodStringDataTests(TestCase): def test_post(self): "Request a view with string data via request method POST" @@ -800,6 +807,14 @@ class RequestMethodStringDataTests(TestCase): self.assertEqual(response.status_code, 200) self.assertEqual(response.content, b'request method: PUT') + def test_patch(self): + "Request a view with string data via request method PATCH" + # Regression test for #17797 + data = u'{"test": "json"}' + response = self.client.patch('/test_client_regress/request_methods/', data=data, content_type='application/json') + self.assertEqual(response.status_code, 200) + self.assertEqual(response.content, b'request method: PATCH') + class QueryStringTests(TestCase): def test_get_like_requests(self): # See: https://code.djangoproject.com/ticket/10571. |
