-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validate policykit::localauthority params + simple rspec
- Loading branch information
Joshua Hoblitt
committed
Aug 30, 2013
1 parent
e829341
commit 8b01bd9
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require 'spec_helper' | ||
|
||
describe 'policykit::localauthority', :type => :define do | ||
|
||
describe 'simple case' do | ||
let(:title) { 'foo' } | ||
let :params do | ||
{ | ||
:identity => 'bar', | ||
:action => 'baz', | ||
:result_any => 'no', | ||
:result_inactive => 'no', | ||
:result_active => 'no', | ||
} | ||
end | ||
|
||
it do | ||
should contain_file('/etc/polkit-1/localauthority/50-local.d/foo.pkla'). | ||
with({ | ||
:ensure => 'present', | ||
:mode => '0644', | ||
}) | ||
end | ||
end | ||
|
||
describe 'title space to underscore conversion in file path' do | ||
# example from https://wiki.archlinux.org/index.php/PolicyKit | ||
let(:title) { 'Ban users jack and jill from using gparted' } | ||
let :params do | ||
{ | ||
:identity => 'unix-user:jack;unix-user:jill', | ||
:action => 'org.archlinux.pkexec.gparted', | ||
:result_any => 'no', | ||
:result_inactive => 'no', | ||
:result_active => 'no', | ||
} | ||
end | ||
|
||
it do | ||
should contain_file('/etc/polkit-1/localauthority/50-local.d/Ban_users_jack_and_jill_from_using_gparted.pkla'). | ||
with({ | ||
:ensure => 'present', | ||
:mode => '0644', | ||
}) | ||
end | ||
end | ||
|
||
describe 'ensure => absent' do | ||
let(:title) { 'foo' } | ||
let :params do | ||
{ | ||
:identity => 'bar', | ||
:action => 'baz', | ||
:result_any => 'no', | ||
:result_inactive => 'no', | ||
:result_active => 'no', | ||
:ensure => 'absent', | ||
} | ||
end | ||
|
||
it do | ||
should contain_file('/etc/polkit-1/localauthority/50-local.d/foo.pkla'). | ||
with({ | ||
:ensure => 'absent', | ||
}) | ||
end | ||
end | ||
|
||
end |