File size: 755 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import unittest

import paramiko.ssh_exception
import pytest

import docker

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))