mirror of
https://github.com/inspec/inspec
synced 2024-11-14 00:47:10 +00:00
4270eb8e80
`must_equal nil` will fail in MiniTest 6. Changing those to `must_be_nil` quiets down all the warnings we currently see and preps us for Minitest 6. Signed-off-by: Adam Leff <adam@leff.co>
42 lines
1.4 KiB
Ruby
42 lines
1.4 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.send('DisplayName')).must_be_nil
|
|
end
|
|
|
|
# centos 7 with systemd
|
|
it 'fail wmi on centos' do
|
|
resource = MockLoader.new(:centos7).load_resource('wmi', {class: 'win32_service', filter: "name like '%winrm%'" })
|
|
_(resource.send('DisplayName')).must_be_nil
|
|
end
|
|
|
|
# unknown OS
|
|
it 'fail wmi on unknown os' do
|
|
resource = MockLoader.new(:undefined).load_resource('wmi', {class: 'win32_service', filter: "name like '%winrm%'" })
|
|
_(resource.send('DisplayName')).must_be_nil
|
|
end
|
|
end
|