test/authentication/test_key_manager.rb in net-ssh-2.9.4 vs test/authentication/test_key_manager.rb in net-ssh-2.10.0.beta1
- old
+ new
@@ -154,11 +154,13 @@
private
def stub_file_private_key(name, key, options = {})
manager.add(name)
+ File.stubs(:file?).with(name).returns(true)
File.stubs(:readable?).with(name).returns(true)
+ File.stubs(:file?).with(name + ".pub").returns(true)
File.stubs(:readable?).with(name + ".pub").returns(false)
case options.fetch(:passphrase, :indifferently)
when :should_be_asked
Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, false).raises(OpenSSL::PKey::RSAError).at_least_once
@@ -177,10 +179,12 @@
end
end
def stub_file_public_key(name, key)
manager.add(name)
- File.stubs(:readable?).with(name).returns(false)
+ File.stubs(:file?).with(name).returns(true)
+ File.stubs(:readable?).with(name).returns(true)
+ File.stubs(:file?).with(name + ".pub").returns(true)
File.stubs(:readable?).with(name + ".pub").returns(true)
Net::SSH::KeyFactory.expects(:load_public_key).with(name + ".pub").returns(key).at_least_once
end