summaryrefslogtreecommitdiffhomepage
path: root/tests/test_util.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2016-04-25 18:33:33 -0700
committerJeff Forcier <jeff@bitprophet.org>2016-04-25 18:33:33 -0700
commit1a92ef5cf9a97a5dcdf96fdfa69ad0900b9dec87 (patch)
tree29af2f4a130a4b944fba86c236905232f8d4ea4d /tests/test_util.py
parent1163fd91e31f280d7b1c4857529fe8314c61fdd5 (diff)
Test & implementation for part 1 re: #670
Diffstat (limited to 'tests/test_util.py')
-rw-r--r--tests/test_util.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index a6a2c30b..e25f0563 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -485,3 +485,33 @@ Host proxycommand-with-equals-none
paramiko.util.lookup_ssh_host_config(host, config),
values
)
+
+ def test_proxycommand_none_masking(self):
+ # Re: https://github.com/paramiko/paramiko/issues/670
+ source_config = """
+Host specific-host
+ ProxyCommand none
+
+Host other-host
+ ProxyCommand other-proxy
+
+Host *
+ ProxyCommand default-proxy
+"""
+ config = paramiko.SSHConfig()
+ config.parse(StringIO(source_config))
+ # When bug is present, the full stripping-out of specific-host's
+ # ProxyCommand means it actually appears to pick up the default
+ # ProxyCommand value instead, due to cascading. It should (for
+ # backwards compatibility reasons in 1.x/2.x) appear completely blank,
+ # as if the host had no ProxyCommand whatsoever.
+ # Threw another unrelated host in there just for sanity reasons.
+ self.assertFalse('proxycommand' in config.lookup('specific-host'))
+ self.assertEqual(
+ config.lookup('other-host')['proxycommand'],
+ 'other-proxy'
+ )
+ self.assertEqual(
+ config.lookup('some-random-host')['proxycommand'],
+ 'default-proxy'
+ )