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
e88ecb28
Commit
e88ecb28
authored
Apr 27, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified test_app.py sshserver.py
parent
20be29f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
sshserver.py
tests/sshserver.py
+3
-3
test_app.py
tests/test_app.py
+6
-3
No files found.
tests/sshserver.py
View file @
e88ecb28
...
@@ -77,14 +77,14 @@ class Server (paramiko.ServerInterface):
...
@@ -77,14 +77,14 @@ class Server (paramiko.ServerInterface):
return
True
return
True
def
run_ssh_server
(
app
):
def
run_ssh_server
(
running
=
True
):
# now connect
# now connect
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
sock
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
sock
.
bind
((
'127.0.0.1'
,
2200
))
sock
.
bind
((
'127.0.0.1'
,
2200
))
sock
.
listen
(
100
)
sock
.
listen
(
100
)
while
not
app
.
_tear_down
:
while
running
:
client
,
addr
=
sock
.
accept
()
client
,
addr
=
sock
.
accept
()
print
(
'Got a connection!'
)
print
(
'Got a connection!'
)
...
@@ -120,4 +120,4 @@ def run_ssh_server(app):
...
@@ -120,4 +120,4 @@ def run_ssh_server(app):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
run_ssh_server
(
False
)
run_ssh_server
()
tests/test_app.py
View file @
e88ecb28
...
@@ -17,11 +17,10 @@ handler.DELAY = 0.1
...
@@ -17,11 +17,10 @@ handler.DELAY = 0.1
class
TestApp
(
AsyncHTTPTestCase
):
class
TestApp
(
AsyncHTTPTestCase
):
_
tear_down
=
False
_
is_running
=
False
def
get_app
(
self
):
def
get_app
(
self
):
loop
=
self
.
io_loop
loop
=
self
.
io_loop
self
.
_tear_down
=
False
options
.
debug
=
True
options
.
debug
=
True
options
.
policy
=
random
.
choice
([
'warning'
,
'autoadd'
])
options
.
policy
=
random
.
choice
([
'warning'
,
'autoadd'
])
options
.
hostFile
=
''
options
.
hostFile
=
''
...
@@ -31,7 +30,11 @@ class TestApp(AsyncHTTPTestCase):
...
@@ -31,7 +30,11 @@ class TestApp(AsyncHTTPTestCase):
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
cls
.
_tear_down
=
True
cls
.
_is_running
=
True
@classmethod
def
__bool__
(
cls
):
return
cls
.
_is_running
def
test_app_with_invalid_form
(
self
):
def
test_app_with_invalid_form
(
self
):
response
=
self
.
fetch
(
'/'
)
response
=
self
.
fetch
(
'/'
)
...
...
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