示例#1
0
 def test_app_error_misc(self):
     resp = Response('\xe9'.encode('utf8'))
     resp.charset = ''
     # dont check the output. just make sure it doesn't fail
     webtest.AppError(to_bytes('message %s'), resp)
     webtest.AppError('messag\xe9 %s', b'\xe9')
示例#2
0
 def test_app_error_with_unicode(self):
     err = webtest.AppError('messag\xe9 %s', '\xe9')
     self.assertEqual(err.args, ('messag\xe9 \xe9', ))
示例#3
0
 def test_app_error_with_bytes_message(self):
     resp = Response('\xe9'.encode('utf8'))
     resp.charset = 'utf8'
     err = webtest.AppError(to_bytes('message %s'), resp)
     self.assertEqual(err.args, ('message \xe9', ))
示例#4
0
 def test_app_error(self):
     resp = Response(to_bytes('blah'))
     err = webtest.AppError('message %s', resp)
     self.assertEqual(err.args, ('message blah', ))
示例#5
0
 def test_app_error_with_unicode(self):
     err = webtest.AppError(six.u('messag\xe9 %s'), six.u('\xe9'))
     self.assertEqual(err.args, (six.u('messag\xe9 \xe9'), ))
示例#6
0
 def _check_status(self, status, res):
     if status is not None and status != res.status_int:
         raise webtest.AppError("Bad response: %s (not %s)\n%s", res.status,
                                status, res)
     super(BetterTestApp, self)._check_status(status, res)