summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2009-01-08 20:49:20 -0700
committerJamis Buck <jamis@37signals.com>2009-01-08 20:53:16 -0700
commitf9b2f3cb8de97730b4b4a5624fdb6e0fd0302f26 (patch)
tree8ef38fee6cc0429e98a6aa4b0fb69c49d1d2be5c /test
parente72a2787fedd1da5fdd2ab071f848d0190a8a85f (diff)
downloadnet-ssh-f9b2f3cb8de97730b4b4a5624fdb6e0fd0302f26.tar.gz
Use foo.pub key by default, but fall back to private key.
Also, make sure we register the private key itself when we load it, so that it doesn't get loaded twice (which causes double passphrase prompts).
Diffstat (limited to 'test')
-rw-r--r--test/authentication/test_key_manager.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/authentication/test_key_manager.rb b/test/authentication/test_key_manager.rb
index ca6b683..af8422b 100644
--- a/test/authentication/test_key_manager.rb
+++ b/test/authentication/test_key_manager.rb
@@ -41,8 +41,8 @@ module Authentication
assert_equal rsa.to_blob, identities.first.to_blob
assert_equal dsa.to_blob, identities.last.to_blob
- assert_equal({:from => :file, :file => "/first"}, manager.known_identities[rsa])
- assert_equal({:from => :file, :file => "/second"}, manager.known_identities[dsa])
+ assert_equal({:from => :file, :file => "/first", :key => rsa}, manager.known_identities[rsa])
+ assert_equal({:from => :file, :file => "/second", :key => dsa}, manager.known_identities[dsa])
end
def test_identities_should_load_from_agent
@@ -78,7 +78,8 @@ module Authentication
def stub_file_key(name, key, also_private=false)
manager.add(name)
- File.expects(:readable?).returns(true)
+ File.expects(:readable?).with(name).returns(true)
+ File.expects(:readable?).with(name + ".pub").returns(false)
Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil).returns(key).at_least_once
key.expects(:public_key).returns(key)
end