From bd803328fce3f06952afed7b2e60a17afb2ef512 Mon Sep 17 00:00:00 2001 From: Sheng Date: Mon, 20 Aug 2018 18:55:00 +0800 Subject: [PATCH] Changed error message --- tests/test_app.py | 6 +++--- webssh/handler.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index b42e77e..e7401f6 100644 --- 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 index 8f0f8e4..5e4f603 100644 --- 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):