jroachgolf84 commented on PR #53100:
URL: https://github.com/apache/airflow/pull/53100#issuecomment-3053890626

   Reverted to the previous lowest dependency, all tests pass, even this one 
(which is explicitly instantiating `SFTPHook` and referencing 
`host_proxy_command`).
   
   ```python
       @patch("paramiko.SSHClient")
       @patch("paramiko.ProxyCommand")
       @patch("airflow.providers.sftp.hooks.sftp.SFTPHook.get_connection")
       def test_sftp_hook_with_proxy_command(self, mock_get_connection, 
mock_proxy_command, mock_ssh_client):
           # Mock the connection to not have a password
           mock_connection = MagicMock()
           mock_connection.login = "user"
           mock_connection.password = None
           mock_connection.host = "example.com"
           mock_connection.port = 22
           mock_connection.extra = None
           mock_get_connection.return_value = mock_connection
   
           mock_sftp_client = MagicMock(spec=SFTPClient)
           mock_ssh_client.open_sftp.return_value = mock_sftp_client
   
           mock_transport = MagicMock()
           mock_ssh_client.return_value.get_transport.return_value = 
mock_transport
           mock_proxy_command.return_value = MagicMock()
   
           host_proxy_cmd = "ncat --proxy-auth proxy_user:**** --proxy 
proxy_host:port %h %p"
   
           hook = SFTPHook(
               remote_host="example.com",
               username="user",
               host_proxy_cmd=host_proxy_cmd,
           )
   
           with hook.get_managed_conn():
               mock_proxy_command.assert_called_once_with(host_proxy_cmd)
               mock_ssh_client.return_value.connect.assert_called_once_with(
                   hostname="example.com",
                   username="user",
                   timeout=None,
                   compress=True,
                   port=22,
                   sock=mock_proxy_command.return_value,
                   look_for_keys=True,
                   banner_timeout=30.0,
                   auth_timeout=None,
               )
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to