diff options
author | Delano Mandelbaum <delano@solutious.com> | 2014-09-30 17:16:54 -0700 |
---|---|---|
committer | Delano Mandelbaum <delano@solutious.com> | 2014-09-30 17:16:54 -0700 |
commit | 2c10a94e81d9f6f0cbf38c8e8c023d5ece9e334b (patch) | |
tree | 966d2a4033e0a1d90505f7b173f693afc65b412a /test | |
parent | af273f19c46c6545bc62cbcfe6b977289d664496 (diff) | |
parent | 9f3958b84433bb3f845d477a404bd670459f7e8c (diff) | |
download | net-ssh-2c10a94e81d9f6f0cbf38c8e8c023d5ece9e334b.tar.gz |
Merge pull request #186 from mfazekas/ignore_unknown_pubkey
Ignore unkown identities instead of failing on it
Diffstat (limited to 'test')
-rw-r--r-- | test/authentication/test_agent.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/authentication/test_agent.rb b/test/authentication/test_agent.rb index 1e24d5e..1613727 100644 --- a/test/authentication/test_agent.rb +++ b/test/authentication/test_agent.rb @@ -110,6 +110,25 @@ module Authentication assert_equal "Okay, but not the best", result.last.comment end + def test_identities_should_ignore_unimplemented_ones + key1 = key + key2 = OpenSSL::PKey::DSA.new(512) + key2.to_blob[0..5]='badkey' + key3 = OpenSSL::PKey::DSA.new(512) + + socket.expect do |s, type, buffer| + assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type + s.return(SSH2_AGENT_IDENTITIES_ANSWER, :long, 3, :string, Net::SSH::Buffer.from(:key, key1), :string, "My favorite key", :string, Net::SSH::Buffer.from(:key, key2), :string, "bad", :string, Net::SSH::Buffer.from(:key, key3), :string, "Okay, but not the best") + end + + result = agent.identities + assert_equal 2,result.size + assert_equal key1.to_blob, result.first.to_blob + assert_equal key3.to_blob, result.last.to_blob + assert_equal "My favorite key", result.first.comment + assert_equal "Okay, but not the best", result.last.comment + end + def test_close_should_close_socket socket.expects(:close) agent.close |