From a20d1ba7f524eb3aa4a1e4a30b2cf94c9d47581f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Thu, 5 Aug 2021 12:25:58 +0200 Subject: test_algorithm should not depeng on known host file contents --- test/transport/test_algorithms.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/transport/test_algorithms.rb b/test/transport/test_algorithms.rb index d79d446..d998d56 100644 --- a/test/transport/test_algorithms.rb +++ b/test/transport/test_algorithms.rb @@ -46,7 +46,9 @@ module Transport end def test_constructor_with_known_hosts_reporting_known_host_key_should_use_that_host_key_type - Net::SSH::KnownHosts.expects(:search_for).with("net.ssh.test,127.0.0.1", {}).returns([stub("key", ssh_type: "ssh-dss")]) + Net::SSH::KnownHosts.expects(:search_for).with("net.ssh.test,127.0.0.1", { + user_known_hosts_file: "/dev/null", global_known_hosts_file: "/dev/null" + }).returns([stub("key", ssh_type: "ssh-dss")]) assert_equal %w[ssh-dss] + ed_ec_host_keys + %w[ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com ssh-rsa rsa-sha2-256 rsa-sha2-512], algorithms[:host_key] end @@ -438,7 +440,10 @@ module Transport end def transport(transport_options={}) - @transport ||= MockTransport.new(transport_options) + @transport ||= MockTransport.new( + {user_known_hosts_file: '/dev/null', + global_known_hosts_file: '/dev/null'}.merge(transport_options) + ) end end end -- cgit v1.2.1