Skip to content

Commit 77b3d0d

Browse files
committed
+test for timeout setting
1 parent 350ef79 commit 77b3d0d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_ssh_client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
os.path.sep.join([os.path.dirname(__file__), 'test_client_private_key']))
3636

3737
class SSHClientTest(unittest.TestCase):
38-
38+
3939
def setUp(self):
4040
self.fake_cmd = 'fake cmd'
4141
self.fake_resp = 'fake response'
@@ -133,6 +133,13 @@ def test_ssh_client_conn_failure(self):
133133
SSHClient, host, port=self.listen_port,
134134
pkey=self.user_key, num_retries=0)
135135

136+
def test_ssh_client_timeout(self):
137+
"""Test connection timeout error"""
138+
with self.assertRaises(ConnectionErrorException) as cm:
139+
SSHClient('127.0.0.1', port=self.listen_port,
140+
pkey=self.user_key, num_retries=0, timeout=1)
141+
142+
self.assertEqual(cm.exception.args[1], 'timed out')
136143

137144
if __name__ == '__main__':
138145
unittest.main()

0 commit comments

Comments
 (0)