inspec/test/unit/resources/wmi_test.rb
Miah Johnson 5fee525be8 Remove os checks from initialize as this is provided by platform (#2797)
Removes skip_resource and raise .. if InSpec.os stuff from initialize as this is covered by platform support.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2018-03-08 16:01:50 -05:00

32 lines
1 KiB
Ruby

# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::WMI' do
# Check the following as unit test
# describe wmi({
# class: 'win32_service',
# filter: "name like '%winrm%'"
# }) do
# its(['Path','ClassName']) { should eq 'Win32_Service' }
# its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}
# end
# windows
it 'verify wmi parsing on windows' do
resource = MockLoader.new(:windows).load_resource('wmi', {class: 'win32_service', filter: "name like '%winrm%'" })
_(resource.send('DisplayName')).must_equal 'Windows Remote Management (WS-Management)'
end
# ubuntu 14.04 with upstart
it 'fail wmi on ubuntu' do
resource = MockLoader.new(:ubuntu1404).load_resource('wmi', {class: 'win32_service', filter: "name like '%winrm%'" })
_(resource.resource_skipped?).must_equal true
_(resource.resource_exception_message)
.must_equal 'Resource Wmi is not supported on platform ubuntu/14.04.'
end
end