test/authentication/test_key_manager.rb in net-ssh-2.7.0 vs test/authentication/test_key_manager.rb in net-ssh-2.8.0
- old
+ new
@@ -16,11 +16,11 @@
def test_add_ensures_list_is_unique
manager.add "/first"
manager.add "/second"
manager.add "/third"
manager.add "/second"
- assert_true manager.key_files.length == 3
+ assert_equal 3, manager.key_files.length
final_files = manager.key_files.map {|item| item.split('/').last}
assert_equal %w(first second third), final_files
end
def test_use_agent_should_be_set_to_false_if_agent_could_not_be_found
@@ -28,23 +28,27 @@
assert manager.use_agent?
assert_nil manager.agent
assert !manager.use_agent?
end
+ def test_use_agent_is_false_if_keys_only
+ assert !manager(:keys_only => true).use_agent?
+ end
+
def test_each_identity_should_load_from_key_files
manager.stubs(:agent).returns(nil)
first = File.expand_path("/first")
second = File.expand_path("/second")
stub_file_private_key first, rsa
- stub_file_private_key second, dsa
+ stub_file_private_key second, dsa
identities = []
manager.each_identity { |identity| identities << identity }
assert_equal 2, identities.length
assert_equal rsa.to_blob, identities.first.to_blob
assert_equal dsa.to_blob, identities.last.to_blob
-
+
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