Skip to content

Commit

Permalink
Added tests for override of user and port from config
Browse files Browse the repository at this point in the history
  • Loading branch information
wbeardall committed Nov 4, 2023
1 parent df05be0 commit 8172296
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions smart_open/tests/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ def test_open_with_openssh_config(self, mock_connect, get_transp_mock):
gss_auth=False, gss_kex=False, gss_deleg_creds=False, gss_trust_dns=False
)

@mock_ssh
def test_open_with_openssh_config_override_port(self, mock_connect, get_transp_mock):
smart_open.open("ssh://another-host:22/")
mock_connect.assert_called_with(
"another-host-domain.com", 22, username="another-user",
key_filename=["/path/to/key/file"], timeout=20., compress=True,
gss_auth=False, gss_kex=False, gss_deleg_creds=False, gss_trust_dns=False
)

@mock_ssh
def test_open_with_openssh_config_override_user(self, mock_connect, get_transp_mock):
smart_open.open("ssh://new-user@another-host/")
mock_connect.assert_called_with(
"another-host-domain.com", 2345, username="new-user",
key_filename=["/path/to/key/file"], timeout=20., compress=True,
gss_auth=False, gss_kex=False, gss_deleg_creds=False, gss_trust_dns=False
)

if __name__ == "__main__":
logging.basicConfig(format="%(asctime)s : %(levelname)s : %(message)s", level=logging.DEBUG)
Expand Down

0 comments on commit 8172296

Please sign in to comment.