diff options
author | Robey Pointer <robey@lag.net> | 2008-07-06 13:37:06 -0700 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2008-07-06 13:37:06 -0700 |
commit | c2ef48cf18c2653aa9f083061a3df942ed9d316e (patch) | |
tree | 1c5d0320b9673ebe31e135e911f6d7113ceba169 /tests | |
parent | 305f5e09a58d4c80740faf564dfdca875d98245f (diff) |
[project @ robey@lag.net-20080706203706-zqxb69qrcgyuf90n]
allow multiple key files to be specified in SSHClient.
suggested by Bernhard Walle.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_client.py | 21 |
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. |