summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-01-06 10:24:24 -0800
committerJohn McCrae <john.mccrae@progress.com>2022-01-31 15:55:54 -0800
commit9967cf8d5862e196492693be698fdfd6e1cae00f (patch)
tree2383e3ca33e928604d7affd71eae63e802d9eef1 /spec
parentc57e0c79048e96df56916fe2b73661fddf048cfe (diff)
downloadchef-9967cf8d5862e196492693be698fdfd6e1cae00f.tar.gz
Updated the chef client to retrieve certs from the Windows registry. Tests included. This is PR3 since I keep trashing them
Signed-off-by: John McCrae <john.mccrae@progress.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/platform/query_helpers_spec.rb35
1 files changed, 20 insertions, 15 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index f23be0e63d..f979bde229 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -17,6 +17,7 @@
#
require "spec_helper"
+require "chef-powershell"
if ChefUtils.windows?
describe "Chef::Platform#supports_dsc_invoke_resource?" do
@@ -42,24 +43,28 @@ if ChefUtils.windows?
describe "Chef::Platform#dsc_refresh_mode_disabled?" do
let(:node) { instance_double("Chef::Node") }
- let(:powershell) { instance_double("Chef::PowerShell") }
+ let(:powershell) { Class.new { include Chef_PowerShell::ChefPowerShell::PowerShellExec } }
+ subject(:object) { powershell.new }
it "returns true when RefreshMode is Disabled" do
- expect(Chef_PowerShell::PowerShell).to receive(:new)
- .with("Get-DscLocalConfigurationManager")
- .and_return(powershell)
- expect(powershell).to receive(:error!)
- expect(powershell).to receive(:result).and_return({ "RefreshMode" => "Disabled" })
- expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
- end
-
- it "returns false when RefreshMode is not Disabled" do
- expect(Chef_PowerShell::PowerShell).to receive(:new)
- .with("Get-DscLocalConfigurationManager")
- .and_return(powershell)
- expect(powershell).to receive(:error!)
- expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" })
+ execution = object.powershell_exec("Get-DscLocalConfigurationManager", :powershell, timeout: -1)
+ # expect(object.powershell_exec("Get-DscLocalConfigurationManager", :powershell, timeout: -1)).to be_kind_of(Chef_PowerShell::PowerShell)
+ # expect(Chef_PowerShell::PowerShell).to receive(:new)
+ # .with("Get-DscLocalConfigurationManager")
+ # .and_return(powershell)
+ # expect(powershell).to receive(:error!)
+ # expect(powershell).to receive(:result).and_return({ "RefreshMode" => "False" })
+ expect(execution.result["RefreshMode"]).to eq "PUSH"
expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false
end
+
+ # it "returns false when RefreshMode is not Disabled" do
+ # expect(Chef::PowerShell).to receive(:new)
+ # .with("Get-DscLocalConfigurationManager")
+ # .and_return(powershell)
+ # expect(powershell).to receive(:error!)
+ # expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" })
+ # expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
+ # end
end
end \ No newline at end of file