Updated tests for new ssh config format.
This commit is contained in:
parent
3563fca994
commit
98ae4e975d
|
@ -104,23 +104,32 @@ class UtilTest(ParamikoTest):
|
||||||
f = cStringIO.StringIO(test_config_file)
|
f = cStringIO.StringIO(test_config_file)
|
||||||
config = paramiko.util.parse_ssh_config(f)
|
config = paramiko.util.parse_ssh_config(f)
|
||||||
self.assertEquals(config._config,
|
self.assertEquals(config._config,
|
||||||
[ {'identityfile': '~/.ssh/id_rsa', 'host': '*', 'user': 'robey',
|
[{'host': ['*'], 'config': {}}, {'host': ['*'], 'config': {'identityfile': ['~/.ssh/id_rsa'], 'user': 'robey'}},
|
||||||
'crazy': 'something dumb '},
|
{'host': ['*.example.com'], 'config': {'user': 'bjork', 'port': '3333'}},
|
||||||
{'host': '*.example.com', 'user': 'bjork', 'port': '3333'},
|
{'host': ['*'], 'config': {'crazy': 'something dumb '}},
|
||||||
{'host': 'spoo.example.com', 'crazy': 'something else'}])
|
{'host': ['spoo.example.com'], 'config': {'crazy': 'something else'}}])
|
||||||
|
|
||||||
def test_3_host_config(self):
|
def test_3_host_config(self):
|
||||||
global test_config_file
|
global test_config_file
|
||||||
f = cStringIO.StringIO(test_config_file)
|
f = cStringIO.StringIO(test_config_file)
|
||||||
config = paramiko.util.parse_ssh_config(f)
|
config = paramiko.util.parse_ssh_config(f)
|
||||||
|
|
||||||
for host, values in {
|
for host, values in {
|
||||||
'irc.danger.com': {'user': 'robey', 'crazy': 'something dumb '},
|
'irc.danger.com': {'crazy': 'something dumb ',
|
||||||
'irc.example.com': {'user': 'bjork', 'crazy': 'something dumb ', 'port': '3333'},
|
'hostname': 'irc.danger.com',
|
||||||
'spoo.example.com': {'user': 'bjork', 'crazy': 'something else', 'port': '3333'}
|
'user': 'robey'},
|
||||||
|
'irc.example.com': {'crazy': 'something dumb ',
|
||||||
|
'hostname': 'irc.example.com',
|
||||||
|
'user': 'robey',
|
||||||
|
'port': '3333'},
|
||||||
|
'spoo.example.com': {'crazy': 'something dumb ',
|
||||||
|
'hostname': 'spoo.example.com',
|
||||||
|
'user': 'robey',
|
||||||
|
'port': '3333'}
|
||||||
}.items():
|
}.items():
|
||||||
values = dict(values,
|
values = dict(values,
|
||||||
hostname=host,
|
hostname=host,
|
||||||
identityfile=os.path.expanduser("~/.ssh/id_rsa")
|
identityfile=[os.path.expanduser("~/.ssh/id_rsa")]
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
paramiko.util.lookup_ssh_host_config(host, config),
|
paramiko.util.lookup_ssh_host_config(host, config),
|
||||||
|
@ -151,8 +160,8 @@ class UtilTest(ParamikoTest):
|
||||||
# just verify that we can pull out 32 bytes and not get an exception.
|
# just verify that we can pull out 32 bytes and not get an exception.
|
||||||
x = rng.read(32)
|
x = rng.read(32)
|
||||||
self.assertEquals(len(x), 32)
|
self.assertEquals(len(x), 32)
|
||||||
|
|
||||||
def test_7_host_config_expose_ssh_issue_33(self):
|
def test_7_host_config_expose_issue_33(self):
|
||||||
test_config_file = """
|
test_config_file = """
|
||||||
Host www13.*
|
Host www13.*
|
||||||
Port 22
|
Port 22
|
||||||
|
|
Loading…
Reference in New Issue