summaryrefslogtreecommitdiffhomepage
path: root/tests/test_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_client.py')
-rw-r--r--tests/test_client.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index 7e5c80b4..3576ef32 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -148,6 +148,40 @@ class SSHClientTest (unittest.TestCase):
stdout.close()
stderr.close()
+ def test_2_5_client_ecdsa(self):
+ """
+ verify that SSHClient works with an ECDSA key.
+ """
+ threading.Thread(target=self._run).start()
+ host_key = paramiko.RSAKey.from_private_key_file(test_path('test_rsa.key'))
+ public_host_key = paramiko.RSAKey(data=host_key.asbytes())
+
+ self.tc = paramiko.SSHClient()
+ self.tc.get_host_keys().add('[%s]:%d' % (self.addr, self.port), 'ssh-rsa', public_host_key)
+ self.tc.connect(self.addr, self.port, username='slowdive', key_filename=test_path('test_ecdsa.key'))
+
+ self.event.wait(1.0)
+ self.assertTrue(self.event.isSet())
+ self.assertTrue(self.ts.is_active())
+ self.assertEqual('slowdive', self.ts.get_username())
+ self.assertEqual(True, self.ts.is_authenticated())
+
+ stdin, stdout, stderr = self.tc.exec_command('yes')
+ schan = self.ts.accept(1.0)
+
+ schan.send('Hello there.\n')
+ schan.send_stderr('This is on stderr.\n')
+ schan.close()
+
+ self.assertEqual('Hello there.\n', stdout.readline())
+ self.assertEqual('', stdout.readline())
+ self.assertEqual('This is on stderr.\n', stderr.readline())
+ self.assertEqual('', stderr.readline())
+
+ stdin.close()
+ stdout.close()
+ stderr.close()
+
def test_3_multiple_key_files(self):
"""
verify that SSHClient accepts and tries multiple key files.