diff options
author | Olle Lundberg <geek@nerd.sh> | 2012-11-20 12:42:29 +0100 |
---|---|---|
committer | Olle Lundberg <geek@nerd.sh> | 2013-02-28 12:31:53 +0100 |
commit | 109d2b200a1e419f139166380fd0d136f4d57321 (patch) | |
tree | 2c47e61ea7f186533848182beaafe4a19bb9c37d /tests | |
parent | ea3c3f53b662eafa5dfa8e25d9543a568b81b353 (diff) |
Add tests for identityfile parsing.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_util.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/test_util.py b/tests/test_util.py index e6f417d4..c4ad9d8a 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -205,7 +205,6 @@ Host * self.assertRaises(AssertionError, lambda: paramiko.util.retry_on_signal(raises_other_exception)) -<<<<<<< HEAD def test_9_proxycommand_config_equals_parsing(self): """ ProxyCommand should not split on equals signs within the value. @@ -300,3 +299,33 @@ ProxyCommand foo=bar:%h-%p paramiko.util.lookup_ssh_host_config(host, config), values ) + + def test_11_host_config_test_identityfile(self): + test_config_file = """ + +IdentityFile id_dsa0 + +Host * +IdentityFile id_dsa1 + +Host dsa2 +IdentityFile id_dsa2 + +Host dsa2* +IdentityFile id_dsa22 + """ + for host, values in { + 'foo' :{'hostname': 'foo', + 'identityfile': ['id_dsa0', 'id_dsa1']}, + 'dsa2' :{'hostname': 'dsa2', + 'identityfile': ['id_dsa0', 'id_dsa1', 'id_dsa2', 'id_dsa22']}, + 'dsa22' :{'hostname': 'dsa22', + 'identityfile': ['id_dsa0', 'id_dsa1', 'id_dsa22']} + }.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 + ) |