mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
refactor tests for resource sys_info.manufacturer and sys_info.model
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
This commit is contained in:
parent
9278d8109d
commit
9c06a0c8e2
1 changed files with 7 additions and 35 deletions
|
@ -3,54 +3,26 @@ require "inspec/resource"
|
|||
require "inspec/resources/sys_info"
|
||||
|
||||
describe "Inspec::Resources::SysInfo" do
|
||||
describe "sys_info.hostname" do
|
||||
it "check sys_info.hostname on Ubuntu" do
|
||||
describe "sys_info" do
|
||||
it "check sys_info on Ubuntu" do
|
||||
resource = MockLoader.new(:ubuntu1504).load_resource("sys_info")
|
||||
_(resource.hostname).must_equal "example.com"
|
||||
_(resource.manufacturer).must_equal "ACME Corp."
|
||||
_(resource.model).must_equal "Flux Capacitor"
|
||||
end
|
||||
|
||||
it "check sys_info on Windows" do
|
||||
resource = MockLoader.new(:windows).load_resource("sys_info")
|
||||
_(resource.hostname).must_equal "WIN-CIV7VMLVHLD"
|
||||
end
|
||||
|
||||
it "check sysinfo.hostname on freebsd" do
|
||||
resource = MockLoader.new(:freebsd10).load_resource("sys_info")
|
||||
_(resource.hostname).must_equal "The `sys_info.hostname` resource is not supported on your OS yet."
|
||||
end
|
||||
end
|
||||
|
||||
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."
|
||||
_(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."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue