Validate the result of locale charmap
This commit is contained in:
+23
-1
@@ -515,6 +515,7 @@ class OtherTestBase(TestAppBase):
|
||||
tdstream = ''
|
||||
maxconn = 20
|
||||
origin = 'same'
|
||||
encoding = ''
|
||||
body = {
|
||||
'hostname': '127.0.0.1',
|
||||
'port': '',
|
||||
@@ -543,7 +544,8 @@ class OtherTestBase(TestAppBase):
|
||||
OtherTestBase.sshserver_port += 1
|
||||
|
||||
t = threading.Thread(
|
||||
target=run_ssh_server, args=(self.sshserver_port, self.running)
|
||||
target=run_ssh_server,
|
||||
args=(self.sshserver_port, self.running, self.encoding)
|
||||
)
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
@@ -762,3 +764,23 @@ class TestAppWithCrossOriginOperation(OtherTestBase):
|
||||
self.assertEqual(
|
||||
response.headers.get('Access-Control-Allow-Origin'), self.origin
|
||||
)
|
||||
|
||||
|
||||
class TestAppWithBadEncoding(OtherTestBase):
|
||||
|
||||
encoding = b'\xe7\xbc\x96\xe7\xa0\x81'
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_app_with_a_bad_encoding(self):
|
||||
response = yield self.async_post('/', self.body)
|
||||
self.assertIn(b'Bad encoding', response.body)
|
||||
|
||||
|
||||
class TestAppWithUnknownEncoding(OtherTestBase):
|
||||
|
||||
encoding = u'UnknownEncoding'
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_app_with_a_bad_encoding(self):
|
||||
response = yield self.async_post('/', self.body)
|
||||
self.assertIn(b'Unknown encoding', response.body)
|
||||
|
||||
Reference in New Issue
Block a user