summaryrefslogtreecommitdiff
path: root/test/transport
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2008-09-06 09:36:14 -0600
committerJamis Buck <jamis@37signals.com>2008-09-06 14:00:58 -0600
commitacbe7c6eff1827aeef3dcfff70478ed66dba3c73 (patch)
treed2485d82d8bb42b7c95c37404f378b94f720be87 /test/transport
parentb09b86cb2a3edcc7ce37799d100ed5d51107ad02 (diff)
downloadnet-ssh-acbe7c6eff1827aeef3dcfff70478ed66dba3c73.tar.gz
tests all pass with ruby19
Diffstat (limited to 'test/transport')
-rw-r--r--test/transport/kex/test_diffie_hellman_group1_sha1.rb6
-rw-r--r--test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb14
-rw-r--r--test/transport/test_cipher_factory.rb24
-rw-r--r--test/transport/test_packet_stream.rb2
-rw-r--r--test/transport/test_session.rb5
5 files changed, 32 insertions, 19 deletions
diff --git a/test/transport/kex/test_diffie_hellman_group1_sha1.rb b/test/transport/kex/test_diffie_hellman_group1_sha1.rb
index 60b1c88..619b716 100644
--- a/test/transport/kex/test_diffie_hellman_group1_sha1.rb
+++ b/test/transport/kex/test_diffie_hellman_group1_sha1.rb
@@ -66,9 +66,9 @@ module Transport; module Kex
assert_equal KEXDH_INIT, buffer.type
assert_equal dh.dh.pub_key, buffer.read_bignum
t.return(KEXDH_REPLY, :string, b(:key, server_key), :bignum, server_dh_pubkey, :string, b(:string, options[:key_type] || "ssh-rsa", :string, signature))
- connection.expect do |t, buffer|
- assert_equal NEWKEYS, buffer.type
- t.return(NEWKEYS)
+ connection.expect do |t2, buffer2|
+ assert_equal NEWKEYS, buffer2.type
+ t2.return(NEWKEYS)
end
end
diff --git a/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb b/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
index 4e780cf..dc5a2bc 100644
--- a/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
+++ b/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
@@ -51,13 +51,13 @@ module Transport; module Kex
assert_equal need_bits, buffer.read_long
assert_equal 8192, buffer.read_long
t.return(KEXDH_GEX_GROUP, :bignum, bn(options[:p] || default_p), :bignum, bn(options[:g] || 2))
- t.expect do |t, buffer|
- assert_equal KEXDH_GEX_INIT, buffer.type
- assert_equal dh.dh.pub_key, buffer.read_bignum
- t.return(KEXDH_GEX_REPLY, :string, b(:key, server_key), :bignum, server_dh_pubkey, :string, b(:string, options[:key_type] || "ssh-rsa", :string, signature))
- t.expect do |t, buffer|
- assert_equal NEWKEYS, buffer.type
- t.return(NEWKEYS)
+ t.expect do |t2, buffer2|
+ assert_equal KEXDH_GEX_INIT, buffer2.type
+ assert_equal dh.dh.pub_key, buffer2.read_bignum
+ t2.return(KEXDH_GEX_REPLY, :string, b(:key, server_key), :bignum, server_dh_pubkey, :string, b(:string, options[:key_type] || "ssh-rsa", :string, signature))
+ t2.expect do |t3, buffer3|
+ assert_equal NEWKEYS, buffer3.type
+ t3.return(NEWKEYS)
end
end
end
diff --git a/test/transport/test_cipher_factory.rb b/test/transport/test_cipher_factory.rb
index b689725..90ec560 100644
--- a/test/transport/test_cipher_factory.rb
+++ b/test/transport/test_cipher_factory.rb
@@ -4,6 +4,10 @@ require 'net/ssh/transport/cipher_factory'
module Transport
class TestCipherFactory < Test::Unit::TestCase
+ def self.if_supported?(name)
+ yield if Net::SSH::Transport::CipherFactory.supported?(name)
+ end
+
def test_lengths_for_none
assert_equal [0,0], factory.get_lengths("none")
assert_equal [0,0], factory.get_lengths("bogus")
@@ -13,8 +17,10 @@ module Transport
assert_equal [16,8], factory.get_lengths("blowfish-cbc")
end
- def test_lengths_for_idea_cbc
- assert_equal [16,8], factory.get_lengths("idea-cbc")
+ if_supported?("idea-cbc") do
+ def test_lengths_for_idea_cbc
+ assert_equal [16,8], factory.get_lengths("idea-cbc")
+ end
end
def test_lengths_for_rijndael_cbc
@@ -51,14 +57,16 @@ module Transport
assert_equal TEXT, decrypt("blowfish-cbc", BLOWFISH)
end
- IDEA = "W\234\017G\231\b\357\370H\b\256U]\343M\031k\233]~\023C\363\263\177\262-\261\341$\022\376mv\217\322\b\2763\270H\306\035\343z\313\312\3531\351\t\201\302U\022\360\300\354ul7$z\320O]\360g\024\305\005`V\005\335A\351\312\270c\320D\232\eQH1\340\265\2118\031g*\303v"
+ if_supported?("idea-cbc") do
+ IDEA = "W\234\017G\231\b\357\370H\b\256U]\343M\031k\233]~\023C\363\263\177\262-\261\341$\022\376mv\217\322\b\2763\270H\306\035\343z\313\312\3531\351\t\201\302U\022\360\300\354ul7$z\320O]\360g\024\305\005`V\005\335A\351\312\270c\320D\232\eQH1\340\265\2118\031g*\303v"
- def test_idea_cbc_for_encryption
- assert_equal IDEA, encrypt("idea-cbc")
- end
+ def test_idea_cbc_for_encryption
+ assert_equal IDEA, encrypt("idea-cbc")
+ end
- def test_idea_cbc_for_decryption
- assert_equal TEXT, decrypt("idea-cbc", IDEA)
+ def test_idea_cbc_for_decryption
+ assert_equal TEXT, decrypt("idea-cbc", IDEA)
+ end
end
RIJNDAEL = "$\253\271\255\005Z\354\336&\312\324\221\233\307Mj\315\360\310Fk\241EfN\037\231\213\361{'\310\204\347I\343\271\005\240`\325;\034\346uM>#\241\231C`\374\261\vo\226;Z\302:\b\250\366T\330\\#V\330\340\226\363\374!\bm\266\232\207!\232\347\340\t\307\370\356z\236\343=v\210\206y"
diff --git a/test/transport/test_packet_stream.rb b/test/transport/test_packet_stream.rb
index 9571f0e..1c5c0a9 100644
--- a/test/transport/test_packet_stream.rb
+++ b/test/transport/test_packet_stream.rb
@@ -370,6 +370,8 @@ module Transport
hmacs = Net::SSH::Transport::HMAC::MAP.keys
ciphers.each do |cipher_name|
+ next unless Net::SSH::Transport::CipherFactory.supported?(cipher_name)
+
hmacs.each do |hmac_name|
[false, :standard].each do |compress|
cipher_method_name = cipher_name.gsub(/\W/, "_")
diff --git a/test/transport/test_session.rb b/test/transport/test_session.rb
index 876fd81..206e134 100644
--- a/test/transport/test_session.rb
+++ b/test/transport/test_session.rb
@@ -4,7 +4,10 @@ require 'net/ssh/transport/session'
# mocha adds #verify to Object, which throws off the host-key-verifier part of
# these tests.
-Object.send(:undef_method, :verify)
+# can't use .include? because ruby18 uses strings and ruby19 uses symbols :/
+if Object.instance_methods.any? { |v| v.to_sym == :verify }
+ Object.send(:undef_method, :verify)
+end
module Transport