Ticket #11371: patch.diff
File patch.diff, 2.2 KB (added by , 15 years ago) |
---|
-
django/test/client.py
362 362 else: 363 363 post_data = data 364 364 365 query_string = None 366 if not isinstance(data, basestring): 367 query_string = urlencode(data, doseq=True) 368 365 369 parsed = urlparse(path) 366 370 r = { 367 371 'CONTENT_LENGTH': len(post_data), 368 372 'CONTENT_TYPE': content_type, 369 373 'PATH_INFO': urllib.unquote(parsed[2]), 370 'QUERY_STRING': urlencode(data, doseq=True)or parsed[4],374 'QUERY_STRING': query_string or parsed[4], 371 375 'REQUEST_METHOD': 'PUT', 372 376 'wsgi.input': FakePayload(post_data), 373 377 } -
tests/regressiontests/test_client_regress/models.py
574 574 self.assertEqual(response.status_code, 200) 575 575 self.assertEqual(response.content, 'request method: DELETE') 576 576 577 class 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 577 594 class QueryStringTests(TestCase): 578 595 def test_get_like_requests(self): 579 596 for method_name in ('get','head','options','put','delete'):