Ticket #11371: tests.diff

File tests.diff, 1.4 KB (added by Johann Heller, 15 years ago)

Tests to prove their is a bug.

  • tests/regressiontests/test_client_regress/models.py

     
    574574        self.assertEqual(response.status_code, 200)
    575575        self.assertEqual(response.content, 'request method: DELETE')
    576576
     577class RequestMethodStringDataTests(TestCase):
     578    def test_post(self):
     579        "Request a view with string data via request method POST"
     580        # Regression test for #11371
     581        data = u'{"test": "json"}'
     582        response = self.client.post('/test_client_regress/request_methods/', data=data, content_type='application/json')
     583        self.assertEqual(response.status_code, 200)
     584        self.assertEqual(response.content, 'request method: POST')
     585
     586    def test_put(self):
     587        "Request a view with string data via request method PUT"
     588        # Regression test for #11371
     589        data = u'{"test": "json"}'
     590        response = self.client.put('/test_client_regress/request_methods/', data=data, content_type='application/json')
     591        self.assertEqual(response.status_code, 200)
     592        self.assertEqual(response.content, 'request method: PUT')
     593
    577594class QueryStringTests(TestCase):
    578595    def test_get_like_requests(self):
    579596        for method_name in ('get','head','options','put','delete'):
Back to Top