Sha256: cc037f8c3300a6124aeed983c9cc8c93a5d06dac069b61c8644e9a1d1ac451b6

Contents?: true

Size: 1.08 KB

Versions: 147

Compression:

Stored size: 1.08 KB

Contents

require 'common'
require 'net/ssh/transport/hmac'

module Transport

  class TestHMAC < Test::Unit::TestCase
    Net::SSH::Transport::HMAC::MAP.each do |name, value|
      method = name.tr("-", "_")
      define_method("test_get_with_#{method}_returns_new_hmac_instance") do
        key = "abcdefghijklmnopqrstuvwxyz"[0,Net::SSH::Transport::HMAC::MAP[name].key_length]
        hmac = Net::SSH::Transport::HMAC.get(name, key)
        assert_instance_of Net::SSH::Transport::HMAC::MAP[name], hmac
        assert_equal key, hmac.key
      end

      define_method("test_key_length_with_#{method}_returns_correct_key_length") do
        assert_equal Net::SSH::Transport::HMAC::MAP[name].key_length, Net::SSH::Transport::HMAC.key_length(name)
      end
    end

    def test_get_with_unrecognized_hmac_raises_argument_error
      assert_raises(ArgumentError) do
        Net::SSH::Transport::HMAC.get("bogus")
      end
    end

    def test_key_length_with_unrecognized_hmac_raises_argument_error
      assert_raises(ArgumentError) do
        Net::SSH::Transport::HMAC.get("bogus")
      end
    end
  end

end

Version data entries

147 entries across 117 versions & 12 rubygems

Version Path
auser-poolparty-1.3.10 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.11 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.12 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.13 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.14 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.15 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.16 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.17 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.5 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.6 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.7 vendor/gems/net-ssh/test/transport/test_hmac.rb
auser-poolparty-1.3.8 vendor/gems/net-ssh/test/transport/test_hmac.rb
fairchild-poolparty-1.3.17 vendor/gems/net-ssh/test/transport/test_hmac.rb
fairchild-poolparty-1.3.5 vendor/gems/net-ssh/test/transport/test_hmac.rb
jayniz-net-ssh-2.0.15 test/transport/test_hmac.rb
kjvarga-net-ssh-2.0.12 test/transport/test_hmac.rb
net-ssh-net-ssh-2.0.12 test/transport/test_hmac.rb
net-ssh-net-ssh-2.0.13 test/transport/test_hmac.rb
net-ssh-net-ssh-2.0.14 test/transport/test_hmac.rb
depengine-0.0.31 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/test/transport/test_hmac.rb