mirror of
https://github.com/inspec/inspec
synced 2024-12-11 22:02:47 +00:00
dada8ea074
macOS 11 Big Sur will be released later this year. Current beta versions return 10.16 as the version, but the product name has changed from 'Mac OS X' to 'macOS'. Train probably needs to be modified to deprecate 'mac_os_x' as a platform in favor of 'macos' but that would be a significant downstream change. Train does fall back to 'darwin' on macOS 10.16, so by adding darwin to the list of platform names for the service resource we are able to work around this for the moment. This is the only location where mac_os_x is currently being used in InSpec. Because we're in a case statement on platform rather than the more generic platform family, we can't simply remove mac_os_x in favor of darwin. Signed-off-by: Bryan McLellan <btm@loftninjas.org>
30 lines
1.2 KiB
Ruby
30 lines
1.2 KiB
Ruby
require "helper"
|
|
require "inspec/resource"
|
|
require "inspec/resources/powershell"
|
|
|
|
describe "Inspec::Resources::Powershell" do
|
|
let(:base64_command) do
|
|
# Encoded version of `$ProgressPreference='SilentlyContinue';Get-Help`
|
|
"JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAUwBpAGwA" \
|
|
"ZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQAnADsARwBlAHQALQBIAGUAbABwAA=="
|
|
end
|
|
|
|
it "properly generates command" do
|
|
resource = MockLoader.new(:windows).load_resource("powershell", "Get-Help")
|
|
_(resource.command).must_equal "Get-Help"
|
|
|
|
resource = MockLoader.new(:macos10_10).load_resource("powershell", "Get-Help")
|
|
_(resource.command).must_equal("pwsh -encodedCommand '#{base64_command}'")
|
|
end
|
|
|
|
it "properly generates command if deprecated `script` is used" do
|
|
expect_deprecation(:resource_script) do
|
|
resource = MockLoader.new(:windows).load_resource("script", "Get-Help")
|
|
_(resource.command).must_equal "Get-Help"
|
|
end
|
|
expect_deprecation(:resource_script) do
|
|
resource = MockLoader.new(:macos10_10).load_resource("script", "Get-Help")
|
|
_(resource.command).must_equal("pwsh -encodedCommand '#{base64_command}'")
|
|
end
|
|
end
|
|
end
|