From 191a5fc08cb8ce08917ad4e8739d7d5efbec2be2 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 5 Nov 2012 17:44:25 -0800 Subject: Implement (& test for) ProxyCommand interpolation. Forgot this earlier. --- tests/test_util.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'tests') 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 + ) -- cgit v1.2.3