|
|
|
@ -10,8 +10,8 @@ import tornado.options as options
|
|
|
|
|
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, print_version,
|
|
|
|
|
get_ssl_context, get_trusted_downstream, get_origin_setting
|
|
|
|
|
get_host_keys_settings, get_policy_setting, base_dir, get_font_setting,
|
|
|
|
|
get_ssl_context, get_trusted_downstream, get_origin_setting, print_version
|
|
|
|
|
)
|
|
|
|
|
from webssh.utils import UnicodeType
|
|
|
|
|
from webssh._version import __version__
|
|
|
|
@ -166,3 +166,15 @@ class TestSettings(unittest.TestCase):
|
|
|
|
|
options.origin = 'www.example.com:80, www.example.org:443'
|
|
|
|
|
result = {'http://www.example.com', 'https://www.example.org'}
|
|
|
|
|
self.assertEqual(get_origin_setting(options), result)
|
|
|
|
|
|
|
|
|
|
def test_get_font_setting(self):
|
|
|
|
|
font_dir = os.path.join(base_dir, 'tests', 'data', 'fonts')
|
|
|
|
|
font = ''
|
|
|
|
|
self.assertEqual(get_font_setting(font, font_dir), 'fake-font')
|
|
|
|
|
|
|
|
|
|
font = 'fake-font'
|
|
|
|
|
self.assertEqual(get_font_setting(font, font_dir), 'fake-font')
|
|
|
|
|
|
|
|
|
|
font = 'wrong-name'
|
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
|
get_font_setting(font, font_dir)
|
|
|
|
|