summaryrefslogtreecommitdiffhomepage
path: root/tests/test_util.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2012-11-05 17:44:25 -0800
committerJeff Forcier <jeff@bitprophet.org>2012-11-05 17:44:25 -0800
commit191a5fc08cb8ce08917ad4e8739d7d5efbec2be2 (patch)
treec17de59bacd8a41dda37d3c917d2c2ce0a536ac9 /tests/test_util.py
parent0981c25cd8ef651e6274feae8b3b6acd0869b680 (diff)
Implement (& test for) ProxyCommand interpolation.
Forgot this earlier.
Diffstat (limited to 'tests/test_util.py')
-rw-r--r--tests/test_util.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index 83de0044..093a2157 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -196,7 +196,7 @@ Host *
self.assertRaises(AssertionError,
lambda: paramiko.util.retry_on_signal(raises_other_exception))
- def test_9_proxycommand_config_parsing(self):
+ def test_9_proxycommand_config_equals_parsing(self):
"""
ProxyCommand should not split on equals signs within the value.
"""
@@ -214,3 +214,29 @@ Host equals-delimited
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
+ )