Code

Ticket #14753: 14753.tests.diff

File 14753.tests.diff, 1.8 KB (added by ojii, 3 years ago)

test case for the issue described

Line 
1diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
2index 1281b91..b661a48 100644
3--- a/tests/regressiontests/test_client_regress/models.py
4+++ b/tests/regressiontests/test_client_regress/models.py
5@@ -876,3 +876,8 @@ class ResponseTemplateDeprecationTests(TestCase):
6     def test_response_no_template(self):
7         response = self.client.get("/test_client_regress/request_methods/")
8         self.assertEqual(response.template, None)
9+
10+
11+class RawPostDataTest(TestCase):
12+    def test_raw_post_data(self):
13+        response = self.client.get("/test_client_regress/raw_post_data/")
14\ No newline at end of file
15diff --git a/tests/regressiontests/test_client_regress/urls.py b/tests/regressiontests/test_client_regress/urls.py
16index 650d80b..31edc96 100644
17--- a/tests/regressiontests/test_client_regress/urls.py
18+++ b/tests/regressiontests/test_client_regress/urls.py
19@@ -26,4 +26,5 @@ urlpatterns = patterns('',
20     (r'^parse_unicode_json/$', views.return_json_file),
21     (r'^check_headers/$', views.check_headers),
22     (r'^check_headers_redirect/$', redirect_to, {'url': '/test_client_regress/check_headers/'}),
23+    (r'^raw_post_data/$', views.raw_post_data),
24 )
25diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
26index 40aa61f..b9540be 100644
27--- a/tests/regressiontests/test_client_regress/views.py
28+++ b/tests/regressiontests/test_client_regress/views.py
29@@ -91,3 +91,6 @@ def check_headers(request):
30     "A view that responds with value of the X-ARG-CHECK header"
31     return HttpResponse('HTTP_X_ARG_CHECK: %s' % request.META.get('HTTP_X_ARG_CHECK', 'Undefined'))
32 
33+
34+def raw_post_data(request):
35+    return HttpResponse(request.raw_post_data)
36\ No newline at end of file