commit bd803328fce3f06952afed7b2e60a17afb2ef512
parent e85ae1692e492a36c9abf36da7c2a36d2dc6afc0
Author: Sheng <webmaster0115@gmail.com>
Date: Mon, 20 Aug 2018 18:55:00 +0800
Changed error message
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/test_app.py b/tests/test_app.py
@@ -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('/')
diff --git a/webssh/handler.py b/webssh/handler.py
@@ -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):