summaryrefslogtreecommitdiffhomepage
path: root/tests/test_transport.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2018-03-12 09:15:55 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-03-12 17:08:04 -0700
commit91b9249616cd0147944ff93fb2d508fac1e30524 (patch)
tree87344e3d94afd9065c424cd074d0f7546f0ebcb7 /tests/test_transport.py
parent430568e1289aee92eeb6f61dc2ea771f0bc22ff8 (diff)
Allow overriding test client connect kwargs in Transport test suite
Diffstat (limited to 'tests/test_transport.py')
-rw-r--r--tests/test_transport.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/test_transport.py b/tests/test_transport.py
index 3e352919..a61cc7a2 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -129,7 +129,9 @@ class TransportTest(unittest.TestCase):
self.socks.close()
self.sockc.close()
- def setup_test_server(self, client_options=None, server_options=None):
+ def setup_test_server(
+ self, client_options=None, server_options=None, connect_kwargs=None,
+ ):
host_key = RSAKey.from_private_key_file(test_path('test_rsa.key'))
public_host_key = RSAKey(data=host_key.asbytes())
self.ts.add_server_key(host_key)
@@ -143,8 +145,13 @@ class TransportTest(unittest.TestCase):
self.server = NullServer()
self.assertTrue(not event.is_set())
self.ts.start_server(event, self.server)
- self.tc.connect(hostkey=public_host_key,
- username='slowdive', password='pygmalion')
+ if connect_kwargs is None:
+ connect_kwargs = dict(
+ hostkey=public_host_key,
+ username='slowdive',
+ password='pygmalion',
+ )
+ self.tc.connect(**connect_kwargs)
event.wait(1.0)
self.assertTrue(event.is_set())
self.assertTrue(self.ts.is_active())