Skip to content

Commit

Permalink
Add tests for identityfile parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
lndbrg committed Feb 28, 2013
1 parent ea3c3f5 commit 109d2b2
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def raises_other_exception():
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.
Expand Down Expand Up @@ -300,3 +299,33 @@ def test_12_host_config_test_proxycommand(self):
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
)

0 comments on commit 109d2b2

Please sign in to comment.