commit e5990f43841a57bd2989cbfc9826c176e5223f00
parent 8e31cf5259b29b8be2eceb9e1f7d0376b8819b2f
Author: Sheng <webmaster0115@gmail.com>
Date: Mon, 23 Apr 2018 15:49:43 +0800
Updated tests
Diffstat:
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/__init__.py b/tests/__init__.py
@@ -0,0 +1,4 @@
+import sys
+
+
+sys.path.insert(0, 'webssh')
diff --git a/tests/known_hosts_example b/tests/known_hosts_example
@@ -0,0 +1 @@
+192.168.1.199 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINwZGQmNFADnAAlm5uFLQTrdxqpNxHdgg4JPbB3sR2kr
diff --git a/tests/test_policy.py b/tests/test_policy.py
@@ -3,8 +3,8 @@ import unittest
import paramiko
from paramiko.client import RejectPolicy, WarningPolicy
-from webssh.policy import AutoAddPolicy, get_policy_dictionary, load_host_keys
-from webssh.policy import get_policy_class, check_policy_setting
+from policy import (AutoAddPolicy, get_policy_dictionary, load_host_keys,
+ get_policy_class, check_policy_setting)
class TestPolicy(unittest.TestCase):
@@ -25,6 +25,10 @@ class TestPolicy(unittest.TestCase):
host_keys = load_host_keys(path)
self.assertFalse(host_keys)
+ path = 'tests/known_hosts_example'
+ host_keys = load_host_keys(path)
+ self.assertEqual(host_keys, paramiko.hostkeys.HostKeys(path))
+
def test_get_policy_class(self):
keys = ['autoadd', 'reject', 'warning']
vals = [AutoAddPolicy, RejectPolicy, WarningPolicy]