Skip to content

Commit

Permalink
Changed error message
Browse files Browse the repository at this point in the history
  • Loading branch information
huashengdun committed Aug 20, 2018
1 parent e85ae16 commit bd80332
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ def test_app_with_invalid_form(self):
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)
Expand All @@ -80,7 +80,7 @@ def test_app_with_invalid_form(self):

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('/')
Expand Down
2 changes: 1 addition & 1 deletion webssh/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_port(self):
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):
Expand Down

0 comments on commit bd80332

Please sign in to comment.