def test_tunnel_without_password(self, ssh_mock): hook = SSHHook(remote_host='remote_host', port='port', username='******', timeout=10, key_file='fake.file') with hook.get_tunnel(1234): ssh_mock.assert_called_once_with('remote_host', ssh_port='port', ssh_username='******', ssh_pkey='fake.file', ssh_proxy=None, local_bind_address=('localhost', ), remote_bind_address=('localhost', 1234), host_pkey_directories=[], logger=hook.log)
def test_tunnel_with_private_key(self, ssh_mock): hook = SSHHook( ssh_conn_id=self.CONN_SSH_WITH_PRIVATE_KEY_EXTRA, remote_host='remote_host', port='port', username='******', timeout=10, ) with hook.get_tunnel(1234): ssh_mock.assert_called_once_with('remote_host', ssh_port='port', ssh_username='******', ssh_pkey=TEST_PKEY, ssh_proxy=None, local_bind_address=('localhost',), remote_bind_address=('localhost', 1234), host_pkey_directories=[], logger=hook.log)