implement security policy resource tests

This commit is contained in:
Christoph Hartmann 2015-09-05 18:23:13 +02:00 committed by Dominik Richter
parent e9e24a6bd5
commit 1b643ae1da
4 changed files with 28 additions and 1 deletions

View file

@ -15,7 +15,10 @@ def loadResource (resource, *args)
}
@cmd_mapping = {
'ps aux' => IO::File.join(scriptpath, '/unit/mock/cmd/ps-aux')
'ps aux' => IO::File.join(scriptpath, '/unit/mock/cmd/ps-aux'),
'type win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/secedit-export'),
'secedit /export /cfg win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/success'),
'del win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/success')
}
# create mock backend

View file

@ -0,0 +1,7 @@
[System Access]
MaximumPasswordAge = 42
[Registry Values]
MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole\SecurityLevel=4,0
[Privilege Rights]
SeUndockPrivilege = *S-1-5-32-544
SeRemoteInteractiveLogonRight = *S-1-5-32-544,*S-1-5-32-555

View file

View file

@ -0,0 +1,17 @@
# encoding: utf-8
require 'helper'
require 'vulcano/resource'
describe 'Vulcano::Resources::SecurityPolicy' do
describe 'security_policy' do
let(:resource) { loadResource('security_policy') }
it 'verify processes resource' do
_(resource.MaximumPasswordAge).must_equal 42
_(resource.send('MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole\SecurityLevel')).must_equal '4,0'
_(resource.SeUndockPrivilege).must_equal '*S-1-5-32-544'
_(resource.SeRemoteInteractiveLogonRight).must_equal '*S-1-5-32-544,*S-1-5-32-555'
end
end
end