summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordelano <delano@solutious.com>2009-08-10 18:41:09 -0400
committerdelano <delano@solutious.com>2009-08-10 18:50:24 -0400
commit2251c54b844bb446ba597e31f185eef8df00903d (patch)
tree6ec2f62c9312f1e87034c311b4ac7965fe71a31e /test
parent5a3f06e7fe158f20b8edee22e7cd40f51e206266 (diff)
downloadnet-ssh-2251c54b844bb446ba597e31f185eef8df00903d.tar.gz
Closes GH-6 Added support for specifying a list of hosts in .ssh/config, with tests
Diffstat (limited to 'test')
-rw-r--r--test/configs/multihost4
-rw-r--r--test/test_config.rb17
2 files changed, 20 insertions, 1 deletions
diff --git a/test/configs/multihost b/test/configs/multihost
new file mode 100644
index 0000000..732975c
--- /dev/null
+++ b/test/configs/multihost
@@ -0,0 +1,4 @@
+Host other.host, test.host
+ Compression yes
+ Port 1980
+ RekeyLimit 2G
diff --git a/test/test_config.rb b/test/test_config.rb
index fb1a848..82ad815 100644
--- a/test/test_config.rb
+++ b/test/test_config.rb
@@ -37,7 +37,22 @@ class TestConfig < Test::Unit::TestCase
assert_equal %w(~/.ssh/id_dsa), config[:keys]
assert !config.key?(:rekey_limit)
end
-
+
+ def test_load_with_multiple_hosts
+ config = Net::SSH::Config.load(config(:multihost), "test.host")
+ assert config['compression']
+ assert_equal '2G', config['rekeylimit']
+ assert_equal 1980, config['port']
+ end
+
+ def test_load_with_multiple_hosts_and_config_should_match_for_both
+ aconfig = Net::SSH::Config.load(config(:multihost), "test.host")
+ bconfig = Net::SSH::Config.load(config(:multihost), "other.host")
+ assert_equal aconfig['port'], bconfig['port']
+ assert_equal aconfig['compression'], bconfig['compression']
+ assert_equal aconfig['rekeylimit'], bconfig['rekeylimit']
+ end
+
def test_load_should_parse_equal_sign_delimiters
config = Net::SSH::Config.load(config(:eqsign), "test.test")
assert config['compression']