From e9af652cab7d564f3799c9a6f5de5ac6922d217c Mon Sep 17 00:00:00 2001 From: Red_M Date: Sun, 20 May 2018 19:28:30 +1000 Subject: Add test cases for #429 and fix feature for #429. --- tests/test_pxssh.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py index 285ec73..452e997 100644 --- a/tests/test_pxssh.py +++ b/tests/test_pxssh.py @@ -85,6 +85,13 @@ class PxsshTestCase(SSHTestBase): if confirmation_strings!=len(confirmation_array): assert False, 'String generated from remote tunneling is incorrect.' + def test_ssh_config_passing_string(self): + ssh = pxssh.pxssh(debug_command_string=True) + config_path = '/fakepath/fake/config_file' + string = ssh.login('server', 'me', password='s3cret', spawn_local_ssh=False, ssh_config=config_path) + if not '-F '+config_path in string: + assert False, 'String generated from SSH config passing is incorrect.' + def test_ssh_key_string(self): ssh = pxssh.pxssh(debug_command_string=True) confirmation_strings = 0 -- cgit v1.2.1 From 501217ccc2ef169b5dcbcf7f618380100b0e9126 Mon Sep 17 00:00:00 2001 From: Red_M Date: Tue, 29 May 2018 20:19:36 +1000 Subject: Fix as per #490 comments. --- tests/test_pxssh.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py index 452e997..d5a5bc4 100644 --- a/tests/test_pxssh.py +++ b/tests/test_pxssh.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import os - +import tempfile import unittest from pexpect import pxssh @@ -87,7 +87,7 @@ class PxsshTestCase(SSHTestBase): def test_ssh_config_passing_string(self): ssh = pxssh.pxssh(debug_command_string=True) - config_path = '/fakepath/fake/config_file' + (temp_file,config_path) = tempfile.mkstemp() string = ssh.login('server', 'me', password='s3cret', spawn_local_ssh=False, ssh_config=config_path) if not '-F '+config_path in string: assert False, 'String generated from SSH config passing is incorrect.' @@ -106,7 +106,8 @@ class PxsshTestCase(SSHTestBase): confirmation_strings = 0 confirmation_array = [' -i True'] - string = ssh.login('server', 'me', password='s3cret', ssh_key='True') + (temp_file,ssh_key) = tempfile.mkstemp() + string = ssh.login('server', 'me', password='s3cret', ssh_key=ssh_key) for confirmation in confirmation_array: if confirmation in string: confirmation_strings+=1 -- cgit v1.2.1 From a2420d0dcd72e92e9ada1711b2425d4b19012c27 Mon Sep 17 00:00:00 2001 From: Red_M Date: Tue, 29 May 2018 20:25:00 +1000 Subject: Update pxssh test. --- tests/test_pxssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py index d5a5bc4..5f82302 100644 --- a/tests/test_pxssh.py +++ b/tests/test_pxssh.py @@ -105,8 +105,8 @@ class PxsshTestCase(SSHTestBase): assert False, 'String generated from forcing the SSH agent sock is incorrect.' confirmation_strings = 0 - confirmation_array = [' -i True'] (temp_file,ssh_key) = tempfile.mkstemp() + confirmation_array = [' -i '+ssh_key] string = ssh.login('server', 'me', password='s3cret', ssh_key=ssh_key) for confirmation in confirmation_array: if confirmation in string: -- cgit v1.2.1