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
189a30af
Commit
189a30af
authored
Apr 23, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test_settings.py
parent
e5990f43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
known_hosts_example2
tests/known_hosts_example2
+1
-0
test_settings.py
tests/test_settings.py
+30
-0
No files found.
tests/known_hosts_example2
0 → 100644
View file @
189a30af
192.168.1.196 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINwZGQmNFADnAAlm5uFLQTrdxqpNxHdgg4JPbB3sR2kr
tests/test_settings.py
0 → 100644
View file @
189a30af
import
os.path
import
unittest
import
tornado.options
as
options
from
settings
import
get_host_keys_settings
,
base_dir
from
policy
import
load_host_keys
class
TestSettings
(
unittest
.
TestCase
):
def
test_get_host_keys_settings
(
self
):
options
.
hostFile
=
''
options
.
sysHostFile
=
''
dic
=
get_host_keys_settings
(
options
)
filename
=
os
.
path
.
join
(
base_dir
,
'known_hosts'
)
self
.
assertEqual
(
dic
[
'host_keys'
],
load_host_keys
(
filename
))
self
.
assertEqual
(
dic
[
'host_keys_filename'
],
filename
)
self
.
assertEqual
(
dic
[
'system_host_keys'
],
load_host_keys
(
os
.
path
.
expanduser
(
'~/.ssh/known_hosts'
))
)
options
.
hostFile
=
'tests/known_hosts_example'
options
.
sysHostFile
=
'tests/known_hosts_example2'
dic2
=
get_host_keys_settings
(
options
)
self
.
assertEqual
(
dic2
[
'host_keys'
],
load_host_keys
(
options
.
hostFile
))
self
.
assertEqual
(
dic2
[
'host_keys_filename'
],
options
.
hostFile
)
self
.
assertEqual
(
dic2
[
'system_host_keys'
],
load_host_keys
(
options
.
sysHostFile
))
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