summaryrefslogtreecommitdiffstats
path: root/spec/unit/other/selinux.rb
blob: e4bdf390ba1d21e6068aba0e2a72ad022dd194cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

require 'puppet/type/selboolean'
require 'puppet/type/selmodule'

describe Puppet.type(:selboolean), " when manipulating booleans" do
	before :each do
		@bool = Puppet::Type::Selboolean.create(
			:name => "foo",
			:value => "on",
			:persistent => true )
	end
	it "should be able to access :name" do
		@bool[:name].should == "foo"
	end
	it "should be able to access :value" do
		@bool.property(:value).should == :on
	end
	it "should set :value to off" do
		@bool[:value] = :off
		@bool.property(:value).should == :off
	end
	it "should be able to access :persistent" do
		@bool[:persistent].should == :true
	end
	it "should set :persistent to false" do
		@bool[:persistent] = false
		@bool[:persistent].should == :false
	end
	after :each do
		Puppet::Type::Selboolean.clear()
	end
end

describe Puppet.type(:selmodule), " when checking policy modules" do
	before :each do
		@module = Puppet::Type::Selmodule.create(
			:name => "foo",
			:selmoduledir => "/some/path",
			:selmodulepath => "/some/path/foo.pp",
			:syncversion => true)
	end
	it "should be able to access :name" do
		@module[:name].should == "foo"
	end
	it "should be able to access :selmoduledir" do
		@module[:selmoduledir].should == "/some/path"
	end
	it "should be able to access :selmodulepath" do
		@module[:selmodulepath].should == "/some/path/foo.pp"
	end
	it "should be able to access :syncversion" do
		@module.property(:syncversion).should == :true
	end
	it "should set the syncversion value to false" do
		@module[:syncversion] = :false
		@module.property(:syncversion).should == :false
	end
	after :each do
		Puppet::Type::Selmodule.clear()
	end
end