Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
bd803328
Commit
bd803328
authored
Aug 20, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed error message
parent
e85ae169
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
test_app.py
tests/test_app.py
+3
-3
handler.py
webssh/handler.py
+1
-1
No files found.
tests/test_app.py
View file @
bd803328
...
@@ -64,11 +64,11 @@ class TestApp(AsyncHTTPTestCase):
...
@@ -64,11 +64,11 @@ class TestApp(AsyncHTTPTestCase):
self
.
assertEqual
(
response
.
code
,
200
)
self
.
assertEqual
(
response
.
code
,
200
)
body
=
'hostname=&port=&username=&password'
body
=
'hostname=&port=&username=&password'
response
=
self
.
fetch
(
'/'
,
method
=
"POST"
,
body
=
body
)
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'
body
=
'hostname=127.0.0.1&port=&username=&password'
response
=
self
.
fetch
(
'/'
,
method
=
"POST"
,
body
=
body
)
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'
body
=
'hostname=127.0.0.1&port=port&username=&password'
response
=
self
.
fetch
(
'/'
,
method
=
"POST"
,
body
=
body
)
response
=
self
.
fetch
(
'/'
,
method
=
"POST"
,
body
=
body
)
...
@@ -80,7 +80,7 @@ class TestApp(AsyncHTTPTestCase):
...
@@ -80,7 +80,7 @@ class TestApp(AsyncHTTPTestCase):
body
=
'hostname=127.0.0.1&port=7000&username=&password'
body
=
'hostname=127.0.0.1&port=7000&username=&password'
response
=
self
.
fetch
(
'/'
,
method
=
"POST"
,
body
=
body
)
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
):
def
test_app_with_wrong_credentials
(
self
):
response
=
self
.
fetch
(
'/'
)
response
=
self
.
fetch
(
'/'
)
...
...
webssh/handler.py
View file @
bd803328
...
@@ -113,7 +113,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -113,7 +113,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
def
get_value
(
self
,
name
):
def
get_value
(
self
,
name
):
value
=
self
.
get_argument
(
name
)
value
=
self
.
get_argument
(
name
)
if
not
value
:
if
not
value
:
raise
ValueError
(
'
Empty {}
'
.
format
(
name
))
raise
ValueError
(
'
The {} field is required
'
.
format
(
name
))
return
value
return
value
def
get_args
(
self
):
def
get_args
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment