2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/sys_info"
|
2016-09-09 08:30:41 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::SysInfo" do
|
2019-06-21 15:05:43 +00:00
|
|
|
describe "sys_info" do
|
|
|
|
it "check sys_info on Ubuntu" do
|
2021-09-29 06:45:39 +00:00
|
|
|
resource = MockLoader.new(:ubuntu).load_resource("sys_info")
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.hostname).must_equal "example.com"
|
2019-06-21 15:05:43 +00:00
|
|
|
_(resource.manufacturer).must_equal "ACME Corp."
|
|
|
|
_(resource.model).must_equal "Flux Capacitor"
|
2016-09-09 08:30:41 +00:00
|
|
|
end
|
|
|
|
|
2019-07-16 19:27:32 +00:00
|
|
|
it "check sys_info on OSX" do
|
2020-07-01 22:35:23 +00:00
|
|
|
resource = MockLoader.new(:macos10_10).load_resource("sys_info")
|
2019-07-16 19:27:32 +00:00
|
|
|
_(resource.hostname).must_equal "example.com"
|
|
|
|
_(resource.manufacturer).must_equal "Apple Inc."
|
|
|
|
_(resource.model).must_equal "MacBookPro13,3"
|
|
|
|
end
|
|
|
|
|
2019-06-21 14:23:47 +00:00
|
|
|
it "check sys_info on Windows" do
|
2019-06-11 22:24:35 +00:00
|
|
|
resource = MockLoader.new(:windows).load_resource("sys_info")
|
|
|
|
_(resource.hostname).must_equal "WIN-CIV7VMLVHLD"
|
2019-06-21 14:23:47 +00:00
|
|
|
_(resource.manufacturer).must_equal "ACME Corp."
|
|
|
|
_(resource.model).must_equal "Flux Capacitor"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "check sysinfo on freebsd" do
|
|
|
|
resource = MockLoader.new(:freebsd10).load_resource("sys_info")
|
2019-06-21 15:05:43 +00:00
|
|
|
_(resource.hostname).must_equal "The `sys_info.hostname` resource is not supported on your OS yet."
|
|
|
|
_(resource.manufacturer).must_equal "The `sys_info.manufacturer` resource is not supported on your OS yet."
|
|
|
|
_(resource.model).must_equal "The `sys_info.model` resource is not supported on your OS yet."
|
2019-06-21 14:23:47 +00:00
|
|
|
end
|
|
|
|
end
|
2016-09-09 08:30:41 +00:00
|
|
|
end
|