summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlle Lundberg <geek@nerd.sh>2012-10-16 13:53:06 +0200
committerOlle Lundberg <geek@nerd.sh>2012-10-16 13:53:06 +0200
commitf33481cc44fb57a788b5726b529383f300d06b36 (patch)
tree2fce403a23bb9b5811030099b19142d07f54303e
parent3174b6c894b125426a7a4bae7f934a0dbe64d5b1 (diff)
Add test for host negation.
-rw-r--r--tests/test_util.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index 6d68af7e..9890cfc2 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -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'}
+ )