mirror of
https://github.com/inspec/inspec
synced 2024-12-04 02:19:50 +00:00
add darwin/OSX tests
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
This commit is contained in:
parent
73f729e4b1
commit
da4168f83d
3 changed files with 11 additions and 1 deletions
|
@ -365,7 +365,7 @@ class MockLoader
|
||||||
"netstat -an -f inet" => cmd.call("hpux-netstat-inet"),
|
"netstat -an -f inet" => cmd.call("hpux-netstat-inet"),
|
||||||
# ipv6 ports on hpux
|
# ipv6 ports on hpux
|
||||||
"netstat -an -f inet6" => cmd.call("hpux-netstat-inet6"),
|
"netstat -an -f inet6" => cmd.call("hpux-netstat-inet6"),
|
||||||
# hostname linux
|
# hostname linux and darwin
|
||||||
"hostname" => cmd.call("hostname"),
|
"hostname" => cmd.call("hostname"),
|
||||||
# hostname windows
|
# hostname windows
|
||||||
"$env:computername" => cmd.call("$env-computername"),
|
"$env:computername" => cmd.call("$env-computername"),
|
||||||
|
@ -375,6 +375,8 @@ class MockLoader
|
||||||
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer" => cmd.call("manufacturer"),
|
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer" => cmd.call("manufacturer"),
|
||||||
# Model linux
|
# Model linux
|
||||||
"cat /sys/class/dmi/id/product_name" => cmd.call("model"),
|
"cat /sys/class/dmi/id/product_name" => cmd.call("model"),
|
||||||
|
# Model darwin
|
||||||
|
"sysctl -n hw.model" => cmd.call("model_darwin"),
|
||||||
# Model windows
|
# Model windows
|
||||||
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model" => cmd.call("model"),
|
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model" => cmd.call("model"),
|
||||||
# windows_hotfix windows
|
# windows_hotfix windows
|
||||||
|
|
1
test/unit/mock/cmd/model_darwin
Normal file
1
test/unit/mock/cmd/model_darwin
Normal file
|
@ -0,0 +1 @@
|
||||||
|
MacBookPro13,3
|
|
@ -11,6 +11,13 @@ describe "Inspec::Resources::SysInfo" do
|
||||||
_(resource.model).must_equal "Flux Capacitor"
|
_(resource.model).must_equal "Flux Capacitor"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "check sys_info on OSX" do
|
||||||
|
resource = MockLoader.new(:osx104).load_resource("sys_info")
|
||||||
|
_(resource.hostname).must_equal "example.com"
|
||||||
|
_(resource.manufacturer).must_equal "Apple Inc."
|
||||||
|
_(resource.model).must_equal "MacBookPro13,3"
|
||||||
|
end
|
||||||
|
|
||||||
it "check sys_info on Windows" do
|
it "check sys_info on Windows" do
|
||||||
resource = MockLoader.new(:windows).load_resource("sys_info")
|
resource = MockLoader.new(:windows).load_resource("sys_info")
|
||||||
_(resource.hostname).must_equal "WIN-CIV7VMLVHLD"
|
_(resource.hostname).must_equal "WIN-CIV7VMLVHLD"
|
||||||
|
|
Loading…
Reference in a new issue