add cninfo announcement

This commit is contained in:
hillerliao
2019-12-15 21:52:58 +08:00
parent 7dc1508458
commit 65a4a5b7a8
24 changed files with 639 additions and 573 deletions

View File

@@ -1,30 +1,30 @@
from flask import current_app, abort
from tests.base import BaseTestCase
class ErrorsTestCase(BaseTestCase):
def test_400(self):
@current_app.route('/400')
def bad_request():
abort(400)
response = self.client.get('/400')
data = response.get_data(as_text=True)
self.assertIn('400 Bad Request', data)
self.assertEqual(response.status_code, 400)
def test_404(self):
response = self.client.get('/nothing')
data = response.get_data(as_text=True)
self.assertIn('404 Not Found', data)
self.assertEqual(response.status_code, 404)
def test_500(self):
@current_app.route('/500')
def internal_server_error_for_test():
abort(500)
response = self.client.get('/500')
data = response.get_data(as_text=True)
self.assertIn('服务器出错', data)
self.assertEqual(response.status_code, 500)
from flask import current_app, abort
from tests.base import BaseTestCase
class ErrorsTestCase(BaseTestCase):
def test_400(self):
@current_app.route('/400')
def bad_request():
abort(400)
response = self.client.get('/400')
data = response.get_data(as_text=True)
self.assertIn('400 Bad Request', data)
self.assertEqual(response.status_code, 400)
def test_404(self):
response = self.client.get('/nothing')
data = response.get_data(as_text=True)
self.assertIn('404 Not Found', data)
self.assertEqual(response.status_code, 404)
def test_500(self):
@current_app.route('/500')
def internal_server_error_for_test():
abort(500)
response = self.client.get('/500')
data = response.get_data(as_text=True)
self.assertIn('服务器出错', data)
self.assertEqual(response.status_code, 500)