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
72df3b9e
Commit
72df3b9e
authored
May 06, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added print_version
parent
934d6dfc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
test_settings.py
tests/test_settings.py
+7
-1
settings.py
webssh/settings.py
+10
-0
No files found.
tests/test_settings.py
View file @
72df3b9e
...
@@ -4,13 +4,19 @@ import paramiko
...
@@ -4,13 +4,19 @@ import paramiko
import
tornado.options
as
options
import
tornado.options
as
options
from
webssh.settings
import
(
from
webssh.settings
import
(
get_host_keys_settings
,
get_policy_setting
,
base_dir
get_host_keys_settings
,
get_policy_setting
,
base_dir
,
print_version
)
)
from
webssh.policy
import
load_host_keys
from
webssh.policy
import
load_host_keys
from
webssh._version
import
__version__
class
TestSettings
(
unittest
.
TestCase
):
class
TestSettings
(
unittest
.
TestCase
):
def
test_print_version
(
self
):
self
.
assertNotEqual
(
print_version
(
False
),
2
,
msg
=
__version__
)
with
self
.
assertRaises
(
SystemExit
):
self
.
assertEqual
(
print_version
(
True
),
2
,
msg
=
__version__
)
def
test_get_host_keys_settings
(
self
):
def
test_get_host_keys_settings
(
self
):
options
.
hostFile
=
''
options
.
hostFile
=
''
options
.
sysHostFile
=
''
options
.
sysHostFile
=
''
...
...
webssh/settings.py
View file @
72df3b9e
import
logging
import
logging
import
os.path
import
os.path
import
sys
import
uuid
import
uuid
from
tornado.options
import
define
from
tornado.options
import
define
from
webssh.policy
import
(
from
webssh.policy
import
(
load_host_keys
,
get_policy_class
,
check_policy_setting
load_host_keys
,
get_policy_class
,
check_policy_setting
)
)
from
webssh._version
import
__version__
def
print_version
(
flag
):
if
flag
:
print
(
__version__
)
sys
.
exit
(
0
)
define
(
'address'
,
default
=
'127.0.0.1'
,
help
=
'listen address'
)
define
(
'address'
,
default
=
'127.0.0.1'
,
help
=
'listen address'
)
...
@@ -15,6 +23,8 @@ define('policy', default='warning',
...
@@ -15,6 +23,8 @@ define('policy', default='warning',
help
=
'missing host key policy, reject|autoadd|warning'
)
help
=
'missing host key policy, reject|autoadd|warning'
)
define
(
'hostFile'
,
default
=
''
,
help
=
'User defined host keys file'
)
define
(
'hostFile'
,
default
=
''
,
help
=
'User defined host keys file'
)
define
(
'sysHostFile'
,
default
=
''
,
help
=
'System wide host keys file'
)
define
(
'sysHostFile'
,
default
=
''
,
help
=
'System wide host keys file'
)
define
(
'version'
,
type
=
bool
,
help
=
'show version information'
,
callback
=
print_version
)
base_dir
=
os
.
path
.
dirname
(
__file__
)
base_dir
=
os
.
path
.
dirname
(
__file__
)
...
...
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