summaryrefslogtreecommitdiff
path: root/tests/ssh/connect_test.py
diff options
context:
space:
mode:
authorMilas Bowman <milas.bowman@docker.com>2022-07-29 15:56:01 -0400
committerMilas Bowman <milas.bowman@docker.com>2022-07-29 15:56:01 -0400
commitc6c2bbdcda6ebfc6afae55fd696fb83bcd8ebdf5 (patch)
treef5123e74d200bb0f22b9a8b193e7e52514850bd1 /tests/ssh/connect_test.py
parentbf1a3518f92eb845d1e39c8c18d9ee137f896c32 (diff)
parent73421027be04c97fc6f50da0647ba47388ed60e5 (diff)
downloaddocker-py-c6c2bbdcda6ebfc6afae55fd696fb83bcd8ebdf5.tar.gz
Merge remote-tracking branch 'upstream/main' into HEAD
Diffstat (limited to 'tests/ssh/connect_test.py')
-rw-r--r--tests/ssh/connect_test.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ssh/connect_test.py b/tests/ssh/connect_test.py
new file mode 100644
index 0000000..3d33a96
--- /dev/null
+++ b/tests/ssh/connect_test.py
@@ -0,0 +1,22 @@
+import os
+import unittest
+
+import docker
+import paramiko.ssh_exception
+import pytest
+from .base import TEST_API_VERSION
+
+
+class SSHConnectionTest(unittest.TestCase):
+ @pytest.mark.skipif('UNKNOWN_DOCKER_SSH_HOST' not in os.environ,
+ reason='Unknown Docker SSH host not configured')
+ def test_ssh_unknown_host(self):
+ with self.assertRaises(paramiko.ssh_exception.SSHException) as cm:
+ docker.APIClient(
+ version=TEST_API_VERSION,
+ timeout=60,
+ # test only valid with Paramiko
+ use_ssh_client=False,
+ base_url=os.environ['UNKNOWN_DOCKER_SSH_HOST'],
+ )
+ self.assertIn('not found in known_hosts', str(cm.exception))