3
require File.dirname(__FILE__) + '/../../spec_helper'
5
require 'puppet/type/selboolean'
6
require 'puppet/type/selmodule'
8
describe Puppet::Type.type(:file), " when manipulating file contexts" do
10
@file = Puppet::Type::File.new(
15
:seltype => "type_t" )
17
it "should use :seluser to get/set an SELinux user file context attribute" do
18
@file.property(:seluser).should == "user_u"
20
it "should use :selrole to get/set an SELinux role file context attribute" do
21
@file.property(:selrole).should == "role_r"
23
it "should use :seltype to get/set an SELinux user file context attribute" do
24
@file.property(:seltype).should == "type_t"
28
describe Puppet::Type.type(:selboolean), " when manipulating booleans" do
30
provider_class = Puppet::Type::Selboolean.provider(Puppet::Type::Selboolean.providers[0])
31
Puppet::Type::Selboolean.expects(:defaultprovider).returns provider_class
33
@bool = Puppet::Type::Selboolean.new(
38
it "should be able to access :name" do
39
@bool[:name].should == "foo"
41
it "should be able to access :value" do
42
@bool.property(:value).should == :on
44
it "should set :value to off" do
46
@bool.property(:value).should == :off
48
it "should be able to access :persistent" do
49
@bool[:persistent].should == :true
51
it "should set :persistent to false" do
52
@bool[:persistent] = false
53
@bool[:persistent].should == :false
57
describe Puppet::Type.type(:selmodule), " when checking policy modules" do
59
provider_class = Puppet::Type::Selmodule.provider(Puppet::Type::Selmodule.providers[0])
60
Puppet::Type::Selmodule.expects(:defaultprovider).returns provider_class
62
@module = Puppet::Type::Selmodule.new(
64
:selmoduledir => "/some/path",
65
:selmodulepath => "/some/path/foo.pp",
68
it "should be able to access :name" do
69
@module[:name].should == "foo"
71
it "should be able to access :selmoduledir" do
72
@module[:selmoduledir].should == "/some/path"
74
it "should be able to access :selmodulepath" do
75
@module[:selmodulepath].should == "/some/path/foo.pp"
77
it "should be able to access :syncversion" do
78
@module.property(:syncversion).should == :true
80
it "should set the syncversion value to false" do
81
@module[:syncversion] = :false
82
@module.property(:syncversion).should == :false