webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 5245560b811ee3ef5c3ab0b97b27f7cdd815e9c6
parent 189a30af9600460e2590ea9e77db4557aafb7e49
Author: Sheng <webmaster0115@gmail.com>
Date:   Mon, 23 Apr 2018 17:03:58 +0800

Updated test_setttings.py

Diffstat:
Mtests/test_settings.py | 29++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tests/test_settings.py b/tests/test_settings.py @@ -1,8 +1,9 @@ import os.path import unittest +import paramiko import tornado.options as options -from settings import get_host_keys_settings, base_dir +from settings import get_host_keys_settings, get_policy_setting, base_dir from policy import load_host_keys @@ -28,3 +29,29 @@ class TestSettings(unittest.TestCase): self.assertEqual(dic2['host_keys_filename'], options.hostFile) self.assertEqual(dic2['system_host_keys'], load_host_keys(options.sysHostFile)) + + def test_get_policy_setting(self): + options.policy = 'warning' + options.hostFile = '' + options.sysHostFile = '' + settings = get_host_keys_settings(options) + instance = get_policy_setting(options, settings) + self.assertIsInstance(instance, paramiko.client.WarningPolicy) + + options.policy = 'autoadd' + options.hostFile = '' + options.sysHostFile = '' + settings = get_host_keys_settings(options) + instance = get_policy_setting(options, settings) + self.assertIsInstance(instance, paramiko.client.AutoAddPolicy) + + options.policy = 'reject' + options.hostFile = '' + options.sysHostFile = '' + settings = get_host_keys_settings(options) + try: + instance = get_policy_setting(options, settings) + except ValueError: + pass + else: + self.assertIsInstance(instance, paramiko.client.RejectPolicy)