Ticket #14753: 14753.tests.diff

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

test case for the issue described

  • tests/regressiontests/test_client_regress/models.py

    diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
    index 1281b91..b661a48 100644
    a b class ResponseTemplateDeprecationTests(TestCase): 
    876876    def test_response_no_template(self):
    877877        response = self.client.get("/test_client_regress/request_methods/")
    878878        self.assertEqual(response.template, None)
     879
     880
     881class RawPostDataTest(TestCase):
     882    def test_raw_post_data(self):
     883        response = self.client.get("/test_client_regress/raw_post_data/")
     884 No newline at end of file
  • tests/regressiontests/test_client_regress/urls.py

    diff --git a/tests/regressiontests/test_client_regress/urls.py b/tests/regressiontests/test_client_regress/urls.py
    index 650d80b..31edc96 100644
    a b urlpatterns = patterns('', 
    2626    (r'^parse_unicode_json/$', views.return_json_file),
    2727    (r'^check_headers/$', views.check_headers),
    2828    (r'^check_headers_redirect/$', redirect_to, {'url': '/test_client_regress/check_headers/'}),
     29    (r'^raw_post_data/$', views.raw_post_data),
    2930)
  • tests/regressiontests/test_client_regress/views.py

    diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
    index 40aa61f..b9540be 100644
    a b def check_headers(request): 
    9191    "A view that responds with value of the X-ARG-CHECK header"
    9292    return HttpResponse('HTTP_X_ARG_CHECK: %s' % request.META.get('HTTP_X_ARG_CHECK', 'Undefined'))
    9393
     94
     95def raw_post_data(request):
     96    return HttpResponse(request.raw_post_data)
     97 No newline at end of file
Back to Top