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 14:23:47 +00:00
|
|
|
describe "sys_info.hostname" do
|
2019-06-21 14:06:54 +00:00
|
|
|
it "check sys_info.hostname on Ubuntu" do
|
2019-06-11 22:24:35 +00:00
|
|
|
resource = MockLoader.new(:ubuntu1504).load_resource("sys_info")
|
|
|
|
_(resource.hostname).must_equal "example.com"
|
2016-09-09 08:30:41 +00:00
|
|
|
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"
|
2016-09-09 08:30:41 +00:00
|
|
|
end
|
|
|
|
|
2019-06-21 14:06:54 +00:00
|
|
|
it "check sysinfo.hostname on freebsd" do
|
2019-06-11 22:24:35 +00:00
|
|
|
resource = MockLoader.new(:freebsd10).load_resource("sys_info")
|
|
|
|
_(resource.hostname).must_equal "The `sys_info.hostname` resource is not supported on your OS yet."
|
2016-09-09 08:30:41 +00:00
|
|
|
end
|
|
|
|
end
|
2019-06-21 14:23:47 +00:00
|
|
|
|
|
|
|
describe "sys_info.manufacturer" do
|
|
|
|
it "check sys_info.manufacturer on Ubuntu" do
|
|
|
|
resource = MockLoader.new(:ubuntu1504).load_resource("sys_info")
|
|
|
|
_(resource.manufacturer).must_equal "ACME Corp."
|
|
|
|
end
|
|
|
|
|
|
|
|
it "check sys_info.manufacturer on Windows" do
|
|
|
|
resource = MockLoader.new(:windows).load_resource("sys_info")
|
|
|
|
_(resource.manufacturer).must_equal "ACME Corp."
|
|
|
|
end
|
|
|
|
|
|
|
|
it "check sysinfo.hostname on freebsd" do
|
|
|
|
resource = MockLoader.new(:freebsd10).load_resource("sys_info")
|
|
|
|
_(resource.manufacturer).must_equal "The `sys_info.hostname` resource is not supported on your OS yet."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "sys_info.model" do
|
|
|
|
it "check sys_info.model on Ubuntu" do
|
|
|
|
resource = MockLoader.new(:ubuntu1504).load_resource("sys_info")
|
|
|
|
_(resource.model).must_equal "Flux Capacitor"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "check sys_info.model on Windows" do
|
|
|
|
resource = MockLoader.new(:windows).load_resource("sys_info")
|
|
|
|
_(resource.model).must_equal "Flux Capacitor"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "check sysinfo on freebsd" do
|
|
|
|
resource = MockLoader.new(:freebsd10).load_resource("sys_info")
|
|
|
|
_(resource.model).must_equal "The `sys_info.hostname` resource is not supported on your OS yet."
|
|
|
|
end
|
|
|
|
end
|
2016-09-09 08:30:41 +00:00
|
|
|
end
|