Changed error message

pull/26/head
Sheng 6 years ago
parent e85ae1692e
commit bd803328fc

@ -64,11 +64,11 @@ class TestApp(AsyncHTTPTestCase):
self.assertEqual(response.code, 200)
body = 'hostname=&port=&username=&password'
response = self.fetch('/', method="POST", body=body)
self.assertIn(b'"status": "Empty hostname"', response.body)
self.assertIn(b'"status": "The hostname field is required"', response.body) # noqa
body = 'hostname=127.0.0.1&port=&username=&password'
response = self.fetch('/', method="POST", body=body)
self.assertIn(b'"status": "Empty port"', response.body)
self.assertIn(b'"status": "The port field is required"', response.body)
body = 'hostname=127.0.0.1&port=port&username=&password'
response = self.fetch('/', method="POST", body=body)
@ -80,7 +80,7 @@ class TestApp(AsyncHTTPTestCase):
body = 'hostname=127.0.0.1&port=7000&username=&password'
response = self.fetch('/', method="POST", body=body)
self.assertIn(b'"status": "Empty username"', response.body)
self.assertIn(b'"status": "The username field is required"', response.body) # noqa
def test_app_with_wrong_credentials(self):
response = self.fetch('/')

@ -113,7 +113,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
def get_value(self, name):
value = self.get_argument(name)
if not value:
raise ValueError('Empty {}'.format(name))
raise ValueError('The {} field is required'.format(name))
return value
def get_args(self):

Loading…
Cancel
Save