diff options
author | Miklós Fazekas <mfazekas@szemafor.com> | 2021-08-05 14:24:21 +0200 |
---|---|---|
committer | Miklós Fazekas <mfazekas@szemafor.com> | 2021-08-05 14:39:08 +0200 |
commit | 903384d7c668dbe85ba9d00a6d1323cce5c53efc (patch) | |
tree | b270aa63f4eaa674cd52741563fecef90c9110ad /test | |
parent | 7d2ad0fbc4a76dd130bde8b811ffa339c5297259 (diff) | |
download | net-ssh-903384d7c668dbe85ba9d00a6d1323cce5c53efc.tar.gz |
Rubocop fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/test_cert_host_auth.rb | 14 | ||||
-rw-r--r-- | test/transport/test_algorithms.rb | 13 |
2 files changed, 14 insertions, 13 deletions
diff --git a/test/integration/test_cert_host_auth.rb b/test/integration/test_cert_host_auth.rb index 97aed81..9619c1f 100644 --- a/test/integration/test_cert_host_auth.rb +++ b/test/integration/test_cert_host_auth.rb @@ -17,7 +17,7 @@ class TestCertHostAuth < NetSSHTest @badcert = "#{dir}/badca" sh "rm -rf #{@badcert} #{@badcert}.pub" sh "ssh-keygen -t rsa -N '' -C 'ca@hosts.netssh' -f #{@badcert}" - + @cert = "#{dir}/ca" sh "rm -rf #{@cert} #{@cert}.pub" sh "ssh-keygen -t rsa -N '' -C 'ca@hosts.netssh' -f #{@cert}" @@ -42,7 +42,7 @@ class TestCertHostAuth < NetSSHTest puts "Data: #{data}" f.write("@cert-authority *.hosts.netssh #{data}") f.close - + start_sshd_7_or_later(config: config_lines, debug: true) do |_pid, port| Timeout.timeout(400) do # We have our own sshd, give it a chance to come up before @@ -64,7 +64,7 @@ class TestCertHostAuth < NetSSHTest def test_failure config_lines = [] config_lines.push("HostCertificate /etc/ssh/ssh_host_ecdsa_key-cert.pub") - + Tempfile.open('empty_kh') do |f| setup_ssh_env do |params| data = File.read(params[:badcert_pub]) @@ -72,13 +72,11 @@ class TestCertHostAuth < NetSSHTest puts "Data: #{data}" f.write("@cert-authority *.hosts.netssh #{data}") f.close - + start_sshd_7_or_later(config: config_lines, debug: true) do |_pid, port| Timeout.timeout(400) do - # We have our own sshd, give it a chance to come up before - # listening. - #sh "ssh net_ssh_1@one.hosts.netssh -p #{port} -o UserKnownHostsFile=#{f.path}" - + # sh "ssh net_ssh_1@one.hosts.netssh -p #{port} -o UserKnownHostsFile=#{f.path}" + sleep 0.2 assert_raises(Net::SSH::HostKeyMismatch) do Net::SSH.start("one.hosts.netssh", "net_ssh_1", password: 'foopwd', port: port, verify_host_key: :always, user_known_hosts_file: [f.path], verbose: :debug) do |ssh| diff --git a/test/transport/test_algorithms.rb b/test/transport/test_algorithms.rb index fbe96a5..cef1b19 100644 --- a/test/transport/test_algorithms.rb +++ b/test/transport/test_algorithms.rb @@ -46,9 +46,10 @@ 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", { - user_known_hosts_file: "/dev/null", global_known_hosts_file: "/dev/null" - }).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 @@ -441,8 +442,10 @@ module Transport def transport(transport_options={}) @transport ||= MockTransport.new( - {user_known_hosts_file: '/dev/null', - global_known_hosts_file: '/dev/null'}.merge(transport_options) + { + user_known_hosts_file: '/dev/null', + global_known_hosts_file: '/dev/null' + }.merge(transport_options) ) end end |