add unit tests for windows feature

This commit is contained in:
Christoph Hartmann 2015-09-20 17:42:56 +02:00 committed by Dominik Richter
parent 8b6fccee92
commit baee8daae8
3 changed files with 26 additions and 0 deletions

View file

@ -69,6 +69,7 @@ def loadResource (resource, *args)
'pip show jinja2' => cmd.call('pip-show-jinja2'),
"Get-Package -Name 'Mozilla Firefox' | ConvertTo-Json" => cmd.call('get-package'),
"New-Object -Type PSObject | Add-Member -MemberType NoteProperty -Name Service -Value (Get-Service -Name dhcp| Select-Object -Property Name, DisplayName, Status) -PassThru | Add-Member -MemberType NoteProperty -Name WMI -Value (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq 'dhcp' -or $_.DisplayName -eq 'dhcp'} | Select-Object -Property StartMode) -PassThru | ConvertTo-Json" => cmd.call('get-service-dhcp'),
"Get-WindowsFeature | Where-Object {$_.Name -eq 'dhcp' -or $_.DisplayName -eq 'dhcp'} | Select-Object -Property Name,DisplayName,Description,Installed,InstallState | ConvertTo-Json" => cmd.call('get-windows-feature'),
}
# load resource

View file

@ -0,0 +1,7 @@
{
"Name": "DHCP",
"DisplayName": "DHCP Server",
"Description": "Dynamic Host Configuration Protocol (DHCP) Server enables you to centrally configure, manage, and provide temporary IP addresses and related information for client computers.",
"Installed": false,
"InstallState": 0
}

View file

@ -0,0 +1,18 @@
# encoding utf-8
require 'helper'
require 'vulcano/resource'
describe 'Vulcano:Resources::Feature' do
describe 'feature' do
let(:resource) { loadResource('windows_feature', 'dhcp') }
# TODO: set windows as mock os
it 'verify windows feature parsing' do
pkg = { name: 'DHCP', description: 'Dynamic Host Configuration Protocol (DHCP) Server enables you to centrally configure, manage, and provide temporary IP addresses and related information for client computers.', installed: false, type: 'windows-feature' }
_(resource.info).must_equal pkg
_(resource.installed?).must_equal false
end
end
end