Fix WinRM elevated shell test

Username, password, and encoded command are now passed via PowerShell arguments which the test needs to account for.
This commit is contained in:
Shawn Neal 2015-06-10 16:17:30 -07:00
parent 1152b4e1df
commit d2671faa56
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
it "wraps command in elevated shell script when elevated is true" do
expect(shell).to receive(:upload).with(kind_of(String), "c:/tmp/vagrant-elevated-shell.ps1")
expect(shell).to receive(:powershell) do |cmd|
expect(cmd).to eq("powershell -executionpolicy bypass -file c:/tmp/vagrant-elevated-shell.ps1")
expect(cmd).to eq("powershell -executionpolicy bypass -file \"c:/tmp/vagrant-elevated-shell.ps1\" " +
"-username \"vagrant\" -password \"password\" -encoded_command \"ZABpAHIAOwAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFAA==\"")
end.and_return({ exitcode: 0 })
expect(subject.execute("dir", { elevated: true })).to eq(0)
end