summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlle Lundberg <geek@nerd.sh>2012-11-20 12:42:29 +0100
committerOlle Lundberg <geek@nerd.sh>2012-11-20 12:42:29 +0100
commit5670e111c95612fc1c96135ca0e942ed89ec5420 (patch)
treee5a7e14c497072b6ab908079413c3cbcdbe2787b
parent78654e82ecfceba30c61974b18fd4809b1ea9899 (diff)
Add tests for identityfile parsing.
-rw-r--r--tests/test_util.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index 9cbc4397..9a155bfa 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -262,3 +262,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
+ )