Skip to content

Commit

Permalink
Added test for check_encoding_setting
Browse files Browse the repository at this point in the history
  • Loading branch information
huashengdun committed Feb 13, 2020
1 parent 7110def commit 83f739c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
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__
Expand Down Expand Up @@ -178,3 +179,9 @@ def test_get_font_setting(self):
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')
1 change: 0 additions & 1 deletion webssh/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 83f739c

Please sign in to comment.