Add test for host negation.

This commit is contained in:
Olle Lundberg 2012-10-16 13:53:06 +02:00
parent 3174b6c894
commit f33481cc44
1 changed files with 23 additions and 0 deletions

View File

@ -212,3 +212,26 @@ Host *
raise AssertionError('foo')
self.assertRaises(AssertionError,
lambda: paramiko.util.retry_on_signal(raises_other_exception))
def test_9_host_config_test_negation(self):
test_config_file = """
Host www13.* !*.example.com
Port 22
Host *.example.com !www13.*
Port 2222
Host www13.*
Port 8080
Host *
Port 3333
"""
f = cStringIO.StringIO(test_config_file)
config = paramiko.util.parse_ssh_config(f)
host = 'www13.example.com'
self.assertEquals(
paramiko.util.lookup_ssh_host_config(host, config),
{'hostname': host, 'port': '8080'}
)