Ticket #27107: 27107-test.diff

File 27107-test.diff, 949 bytes (added by Tim Graham, 8 years ago)
  • tests/requests/tests.py

    diff --git a/tests/requests/tests.py b/tests/requests/tests.py
    index 0465f0a..3553c41 100644
    a b class RequestsTests(SimpleTestCase):  
    349349        self.assertEqual(request.body, b'name=value')
    350350        self.assertEqual(request.read(), b'name=value')
    351351
     352    def test_set_encoding(self):
     353        payload = FakePayload('name=value')
     354        request = WSGIRequest({'REQUEST_METHOD': 'POST',
     355                               'CONTENT_TYPE': 'application/x-www-form-urlencoded',
     356                               'CONTENT_LENGTH': len(payload),
     357                               'wsgi.input': payload})
     358        self.assertEqual(request.POST, {'name': ['value']})
     359        request.encoding ='iso-8859-1'
     360        self.assertEqual(request.POST, {'name': ['value']})
     361
    352362    def test_value_after_read(self):
    353363        """
    354364        Construction of POST or body is not allowed after reading
Back to Top