Add test for private key paths with '%' characters

This commit is contained in:
Brian Cain 2018-11-09 10:38:49 -08:00
parent 80ac5aaf90
commit f8bd2b3f82
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 22 additions and 0 deletions

View File

@ -86,6 +86,28 @@ describe Vagrant::Util::SSH do
.with(ssh_path, "vagrant@localhost", "-p", "2222", "-o", "LogLevel=FATAL","-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", ssh_info[:private_key_path][0])
end
context "when using '%' in a private_key_path" do
let(:private_key_path) { "/tmp/percent%folder" }
let(:ssh_info) {{
host: "localhost",
port: 2222,
username: "vagrant",
private_key_path: [private_key_path],
compression: true,
dsa_authentication: true
}}
let(:ssh_path) { "/usr/bin/ssh" }
it "uses the IdentityFile argument and escapes the '%' character" do
allow(Vagrant::Util::SafeExec).to receive(:exec).and_return(nil)
described_class.exec(ssh_info)
expect(Vagrant::Util::SafeExec).to have_received(:exec)
.with(ssh_path, "vagrant@localhost", "-p", "2222", "-o", "LogLevel=FATAL","-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentityFile=\"/tmp/percent%%folder\"")
end
end
context "when disabling compression or dsa_authentication flags" do
let(:ssh_info) {{
host: "localhost",