add darwin/OSX tests

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
This commit is contained in:
Eike Waldt 2019-07-16 21:27:32 +02:00
parent 73f729e4b1
commit da4168f83d
No known key found for this signature in database
GPG key ID: D1E0FBB747DCAE4B
3 changed files with 11 additions and 1 deletions

View file

@ -365,7 +365,7 @@ class MockLoader
"netstat -an -f inet" => cmd.call("hpux-netstat-inet"),
# ipv6 ports on hpux
"netstat -an -f inet6" => cmd.call("hpux-netstat-inet6"),
# hostname linux
# hostname linux and darwin
"hostname" => cmd.call("hostname"),
# hostname windows
"$env:computername" => cmd.call("$env-computername"),
@ -375,6 +375,8 @@ class MockLoader
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer" => cmd.call("manufacturer"),
# Model linux
"cat /sys/class/dmi/id/product_name" => cmd.call("model"),
# Model darwin
"sysctl -n hw.model" => cmd.call("model_darwin"),
# Model windows
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model" => cmd.call("model"),
# windows_hotfix windows

View file

@ -0,0 +1 @@
MacBookPro13,3

View file

@ -11,6 +11,13 @@ describe "Inspec::Resources::SysInfo" do
_(resource.model).must_equal "Flux Capacitor"
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
resource = MockLoader.new(:windows).load_resource("sys_info")
_(resource.hostname).must_equal "WIN-CIV7VMLVHLD"