summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlle Lundberg <geek@nerd.sh>2012-10-16 16:38:09 +0200
committerOlle Lundberg <geek@nerd.sh>2013-02-28 12:10:55 +0100
commitb3d5156019566c972a3dbbea851cffed3cf08514 (patch)
treeaa6e7feaca2b9e7e2617e536bd961d859dbec286
parent42d77483e846db5e43296d7055d059e43168dab7 (diff)
Add tests for proxycommand parsing.
-rw-r--r--tests/test_util.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index 4bb34da5..c97c1d58 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -271,3 +271,30 @@ Host *
paramiko.util.lookup_ssh_host_config(host, config),
{'hostname': host, 'port': '8080'}
)
+ def test_10_host_config_test_proxycommand(self):
+ test_config_file = """
+Host proxy-with-equal-divisor-and-space
+ProxyCommand = foo=bar
+
+Host proxy-with-equal-divisor-and-no-space
+ProxyCommand=foo=bar
+
+Host proxy-without-equal-divisor
+ProxyCommand foo=bar:%h-%p
+ """
+ for host, values in {
+ 'proxy-with-equal-divisor-and-space' :{'hostname': 'proxy-with-equal-divisor-and-space',
+ 'proxycommand': 'foo=bar'},
+ 'proxy-with-equal-divisor-and-no-space':{'hostname': 'proxy-with-equal-divisor-and-no-space',
+ 'proxycommand': 'foo=bar'},
+ 'proxy-without-equal-divisor' :{'hostname': 'proxy-without-equal-divisor',
+ 'proxycommand':
+ 'foo=bar:proxy-without-equal-divisor-22'}
+ }.items():
+
+ f = cStringIO.StringIO(test_config_file)
+ config = paramiko.util.parse_ssh_config(f)
+ self.assertEquals(
+ paramiko.util.lookup_ssh_host_config(host, config),
+ values
+ )