Lowercase all option names

This commit is contained in:
Sheng
2018-10-15 22:06:02 +08:00
parent 12f4c0d0d2
commit 499f3b6dcd
4 changed files with 52 additions and 52 deletions
+10 -10
View File
@@ -43,9 +43,9 @@ class TestAppBasic(AsyncHTTPTestCase):
loop = self.io_loop
options.debug = False
options.policy = random.choice(['warning', 'autoadd'])
options.hostFile = ''
options.sysHostFile = ''
options.proxies = ''
options.hostfile = ''
options.syshostfile = ''
options.tdstream = ''
app = make_app(make_handlers(loop, options), get_app_settings(options))
return app
@@ -442,9 +442,9 @@ class OtherTestBase(AsyncHTTPTestCase):
headers = {'Cookie': '_xsrf=yummy'}
debug = False
policy = None
hostFile = ''
sysHostFile = ''
proxies = ''
hostfile = ''
syshostfile = ''
tdstream = ''
body = {
'hostname': '127.0.0.1',
'port': '',
@@ -458,9 +458,9 @@ class OtherTestBase(AsyncHTTPTestCase):
loop = self.io_loop
options.debug = self.debug
options.policy = self.policy if self.policy else random.choice(['warning', 'autoadd']) # noqa
options.hostFile = self.hostFile
options.sysHostFile = self.sysHostFile
options.proxies = self.proxies
options.hostfile = self.hostfile
options.syshostfile = self.syshostfile
options.tdstream = self.tdstream
app = make_app(make_handlers(loop, options), get_app_settings(options))
return app
@@ -542,7 +542,7 @@ class TestAppMiscell(OtherTestBase):
class TestAppWithRejectPolicy(OtherTestBase):
policy = 'reject'
hostFile = make_tests_data_path('known_hosts_example')
hostfile = make_tests_data_path('known_hosts_example')
@tornado.testing.gen_test
def test_app_with_hostname_not_in_hostkeys(self):
+24 -24
View File
@@ -32,8 +32,8 @@ class TestSettings(unittest.TestCase):
sys.stdout = sys_stdout
def test_get_host_keys_settings(self):
options.hostFile = ''
options.sysHostFile = ''
options.hostfile = ''
options.syshostfile = ''
dic = get_host_keys_settings(options)
filename = os.path.join(base_dir, 'known_hosts')
@@ -44,33 +44,33 @@ class TestSettings(unittest.TestCase):
load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
)
options.hostFile = make_tests_data_path('known_hosts_example')
options.sysHostFile = make_tests_data_path('known_hosts_example2')
options.hostfile = make_tests_data_path('known_hosts_example')
options.syshostfile = make_tests_data_path('known_hosts_example2')
dic2 = get_host_keys_settings(options)
self.assertEqual(dic2['host_keys'], load_host_keys(options.hostFile))
self.assertEqual(dic2['host_keys_filename'], options.hostFile)
self.assertEqual(dic2['host_keys'], load_host_keys(options.hostfile))
self.assertEqual(dic2['host_keys_filename'], options.hostfile)
self.assertEqual(dic2['system_host_keys'],
load_host_keys(options.sysHostFile))
load_host_keys(options.syshostfile))
def test_get_policy_setting(self):
options.policy = 'warning'
options.hostFile = ''
options.sysHostFile = ''
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 = ''
options.hostfile = ''
options.syshostfile = ''
settings = get_host_keys_settings(options)
instance = get_policy_setting(options, settings)
self.assertIsInstance(instance, paramiko.client.AutoAddPolicy)
os.unlink(settings['host_keys_filename'])
options.policy = 'reject'
options.hostFile = ''
options.sysHostFile = ''
options.hostfile = ''
options.syshostfile = ''
settings = get_host_keys_settings(options)
try:
instance = get_policy_setting(options, settings)
@@ -122,18 +122,18 @@ class TestSettings(unittest.TestCase):
self.assertIsNotNone(ssl_ctx)
def test_get_trusted_downstream(self):
options.proxies = ''
proxies = set()
self.assertEqual(get_trusted_downstream(options), proxies)
options.tdstream = ''
tdstream = set()
self.assertEqual(get_trusted_downstream(options), tdstream)
options.proxies = '1.1.1.1, 2.2.2.2'
proxies = set(['1.1.1.1', '2.2.2.2'])
self.assertEqual(get_trusted_downstream(options), proxies)
options.tdstream = '1.1.1.1, 2.2.2.2'
tdstream = set(['1.1.1.1', '2.2.2.2'])
self.assertEqual(get_trusted_downstream(options), tdstream)
options.proxies = '1.1.1.1, 2.2.2.2, 2.2.2.2'
proxies = set(['1.1.1.1', '2.2.2.2'])
self.assertEqual(get_trusted_downstream(options), proxies)
options.tdstream = '1.1.1.1, 2.2.2.2, 2.2.2.2'
tdstream = set(['1.1.1.1', '2.2.2.2'])
self.assertEqual(get_trusted_downstream(options), tdstream)
options.proxies = '1.1.1.1, 2.2.2.'
options.tdstream = '1.1.1.1, 2.2.2.'
with self.assertRaises(ValueError):
get_trusted_downstream(options), proxies
get_trusted_downstream(options), tdstream