Files
puppet-openstacklib/spec/defines/openstacklib_policy_spec.rb
ZhongShengping 7ce50f94b8 Update resource references for dependencies
The latest version of puppet now reports these as catalog failures so
this change removes the unnecessary references and the references
should be updated.

Change-Id: Id09c3358c5843510e6a2a8c0e2d4aeb3607e098b
Closes-Bug: #1702964
2017-07-11 17:23:15 +08:00

54 lines
1.5 KiB
Ruby

require 'spec_helper'
describe 'openstacklib::policy::base' do
shared_examples_for 'openstacklib::policy' do
context 'with some basic parameters' do
let :title do
'nova-contest_is_admin'
end
let :params do
{:file_path => '/etc/nova/policy.json',
:key => 'context_is_admin or owner',
:value => 'foo:bar'}
end
it 'configures (modifies) the proper policy' do
is_expected.to contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar').with(
'lens' => 'Json.lns',
'incl' => '/etc/nova/policy.json',
'changes' => 'set dict/entry[*][.="context_is_admin or owner"]/string "foo:bar"',
)
end
it 'configures (adds) the proper policy' do
is_expected.to contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar-add').with(
'lens' => 'Json.lns',
'incl' => '/etc/nova/policy.json',
'changes' => [
'set dict/entry[last()+1] "context_is_admin or owner"',
'set dict/entry[last()]/string "foo:bar"'
],
'onlyif' => 'match dict/entry[*][.="context_is_admin or owner"] size == 0'
)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'openstacklib::policy'
end
end
end