diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2012-12-02 06:48:32 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2012-12-02 06:48:32 -0500 |
commit | 7bde7840dd4ffeae3c794eca216244975c856f94 (patch) | |
tree | 4768627ba0e5e74234d8bba2f4674715b87d1772 /tests | |
parent | 45aa88b530cff0ad09f5da83efd4697ba7986563 (diff) | |
parent | 0ae0e9800c7bfb3f8ea40fa0d33ebf6dff49f759 (diff) |
Merge with master
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_util.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/test_util.py b/tests/test_util.py index 458709b2..093a2157 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -27,6 +27,7 @@ import os import unittest from Crypto.Hash import SHA import paramiko.util +from paramiko.util import lookup_ssh_host_config as host_config from util import ParamikoTest @@ -151,7 +152,7 @@ class UtilTest(ParamikoTest): x = rng.read(32) self.assertEquals(len(x), 32) - def test_7_host_config_expose_issue_33(self): + def test_7_host_config_expose_ssh_issue_33(self): test_config_file = """ Host www13.* Port 22 @@ -194,3 +195,48 @@ Host * raise AssertionError('foo') self.assertRaises(AssertionError, lambda: paramiko.util.retry_on_signal(raises_other_exception)) + + def test_9_proxycommand_config_equals_parsing(self): + """ + ProxyCommand should not split on equals signs within the value. + """ + conf = """ +Host space-delimited + ProxyCommand foo bar=biz baz + +Host equals-delimited + ProxyCommand=foo bar=biz baz +""" + f = cStringIO.StringIO(conf) + config = paramiko.util.parse_ssh_config(f) + for host in ('space-delimited', 'equals-delimited'): + self.assertEquals( + host_config(host, config)['proxycommand'], + 'foo bar=biz baz' + ) + + def test_10_proxycommand_interpolation(self): + """ + ProxyCommand should perform interpolation on the value + """ + config = paramiko.util.parse_ssh_config(cStringIO.StringIO(""" +Host * + Port 25 + ProxyCommand host %h port %p + +Host specific + Port 37 + ProxyCommand host %h port %p lol + +Host portonly + Port 155 +""")) + for host, val in ( + ('foo.com', "host foo.com port 25"), + ('specific', "host specific port 37 lol"), + ('portonly', "host portonly port 155"), + ): + self.assertEquals( + host_config(host, config)['proxycommand'], + val + ) |