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
redcar-0.6 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.6.1dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.1 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.6dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.5dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.4dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.3dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.2dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.5.1dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.4.1 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.4 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.10.1dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.10.0dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.9 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.9.0dev plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.8.3 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.8.2 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.8.1 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb
redcar-0.3.8 plugins/project/vendor/net-ssh/test/transport/test_hmac.rb