summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_client.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index d372eebb..59cd67cb 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -148,8 +148,25 @@ class SSHClientTest (unittest.TestCase):
stdin.close()
stdout.close()
stderr.close()
+
+ def test_3_multiple_key_files(self):
+ """
+ verify that SSHClient accepts and tries multiple key files.
+ """
+ host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key')
+ public_host_key = paramiko.RSAKey(data=str(host_key))
+
+ self.tc = paramiko.SSHClient()
+ self.tc.get_host_keys().add(self.addr, 'ssh-rsa', public_host_key)
+ self.tc.connect(self.addr, self.port, username='slowdive', key_filename=[ 'tests/test_rsa.key', 'tests/test_dss.key' ])
+
+ self.event.wait(1.0)
+ self.assert_(self.event.isSet())
+ self.assert_(self.ts.is_active())
+ self.assertEquals('slowdive', self.ts.get_username())
+ self.assertEquals(True, self.ts.is_authenticated())
- def test_3_auto_add_policy(self):
+ def test_4_auto_add_policy(self):
"""
verify that SSHClient's AutoAddPolicy works.
"""
@@ -169,7 +186,7 @@ class SSHClientTest (unittest.TestCase):
self.assertEquals(1, len(self.tc.get_host_keys()))
self.assertEquals(public_host_key, self.tc.get_host_keys()[self.addr]['ssh-rsa'])
- def test_4_cleanup(self):
+ def test_5_cleanup(self):
"""
verify that when an SSHClient is collected, its transport (and the
transport's packetizer) is closed.