summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabKlein <gabriel.klein.fr@gmail.com>2013-03-28 13:17:40 -0700
committerGabKlein <gabriel.klein.fr@gmail.com>2013-03-28 13:17:40 -0700
commitae2b3db59577163a29e602369d33a24ffe53d98d (patch)
tree97eb4b69f2da7fbec67644bba32237e6c85b9246
parentbfc0144ea21347178e450788ff23ae2952b2a8dd (diff)
downloadnet-ssh-ae2b3db59577163a29e602369d33a24ffe53d98d.tar.gz
Add Host substitution tests
-rw-r--r--test/configs/substitutes8
-rw-r--r--test/test_config.rb18
2 files changed, 26 insertions, 0 deletions
diff --git a/test/configs/substitutes b/test/configs/substitutes
new file mode 100644
index 0000000..9f04a69
--- /dev/null
+++ b/test/configs/substitutes
@@ -0,0 +1,8 @@
+Host test
+ HostName %h.sufix
+
+Host 1234
+ HostName prefix.%h.sufix
+
+Host *
+ HostName %h \ No newline at end of file
diff --git a/test/test_config.rb b/test/test_config.rb
index 548072f..421e088 100644
--- a/test/test_config.rb
+++ b/test/test_config.rb
@@ -111,6 +111,24 @@ class TestConfig < Test::Unit::TestCase
assert_equal '2G', config['rekeylimit']
assert_equal 1980, config['port']
end
+
+ def test_load_wildcar_with_substitutes
+ config = Net::SSH::Config.load(config(:substitutes), "*")
+ net_ssh = Net::SSH::Config.translate(config)
+ assert_equal '*', net_ssh[:host_name]
+ end
+
+ def test_load_sufix_with_substitutes
+ config = Net::SSH::Config.load(config(:substitutes), "test")
+ net_ssh = Net::SSH::Config.translate(config)
+ assert_equal 'test.sufix', net_ssh[:host_name]
+ end
+
+ def test_load_prefix_and_sufix_with_substitutes
+ config = Net::SSH::Config.load(config(:substitutes), "1234")
+ net_ssh = Net::SSH::Config.translate(config)
+ assert_equal 'prefix.1234.sufix', net_ssh[:host_name]
+ end
private