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 83f739ca3509b7fcff63256e977325c2a89e3a86
parent 7110def7475776b4435880f4c9a754fa4af1d6f3
Author: Sheng <webmaster0115@gmail.com>
Date:   Thu, 13 Feb 2020 10:15:29 +0800

Added test for check_encoding_setting

Diffstat:
Mtests/test_settings.py | 9++++++++-
Mwebssh/settings.py | 1-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/test_settings.py b/tests/test_settings.py @@ -11,7 +11,8 @@ from tests.utils import make_tests_data_path from webssh.policy import load_host_keys from webssh.settings import ( get_host_keys_settings, get_policy_setting, base_dir, get_font_filename, - get_ssl_context, get_trusted_downstream, get_origin_setting, print_version + get_ssl_context, get_trusted_downstream, get_origin_setting, print_version, + check_encoding_setting ) from webssh.utils import UnicodeType from webssh._version import __version__ @@ -178,3 +179,9 @@ class TestSettings(unittest.TestCase): font = 'wrong-name' with self.assertRaises(ValueError): get_font_filename(font, font_dir) + + def test_check_encoding_setting(self): + self.assertIsNone(check_encoding_setting('')) + self.assertIsNone(check_encoding_setting('utf-8')) + with self.assertRaises(ValueError): + check_encoding_setting('unknown-encoding') diff --git a/webssh/settings.py b/webssh/settings.py @@ -193,4 +193,3 @@ def get_font_filename(font, font_dir): def check_encoding_setting(encoding): if encoding and not is_valid_encoding(encoding): raise ValueError('Unknown character encoding.') - return encoding