[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
James Turnbull
james at lovedthanlost.net
Fri Jan 23 14:21:57 UTC 2009
The following commit has been merged in the master branch:
commit 4b2bdf981431b11b6c9829d3c2d81abe0f1c71ba
Author: Nigel Kersten <nigelk at google.com>
Date: Mon Dec 8 18:37:27 2008 -0800
Fix the spec tests to work on other platforms, do the confine around OS X versions more sanely
diff --git a/lib/puppet/provider/macauthorization/macauthorization.rb b/lib/puppet/provider/macauthorization/macauthorization.rb
index 67e4e06..2cdef6c 100644
--- a/lib/puppet/provider/macauthorization/macauthorization.rb
+++ b/lib/puppet/provider/macauthorization/macauthorization.rb
@@ -12,10 +12,15 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe
confine :operatingsystem => :darwin
- product_version = sw_vers "-productVersion"
-
- confine :true => if /^10.5/.match(product_version) or /^10.6/.match(product_version)
- true
+ # This should be confined based on macosx_productversion once
+ # http://projects.reductivelabs.com/issues/show/1796
+ # is resolved.
+ if FileTest.exists?("/usr/bin/sw_vers")
+ product_version = sw_vers "-productVersion"
+
+ confine :true => if /^10.5/.match(product_version) or /^10.6/.match(product_version)
+ true
+ end
end
defaultfor :operatingsystem => :darwin
diff --git a/lib/rake b/lib/rake
deleted file mode 120000
index 0ac8c76..0000000
--- a/lib/rake
+++ /dev/null
@@ -1 +0,0 @@
-/Qualia/Repos/github/reductive-build/lib/rake
\ No newline at end of file
diff --git a/spec/unit/provider/macauthorization.rb b/spec/unit/provider/macauthorization.rb
old mode 100644
new mode 100755
index 4754b11..8c9636f
--- a/spec/unit/provider/macauthorization.rb
+++ b/spec/unit/provider/macauthorization.rb
@@ -16,31 +16,27 @@ describe provider_class do
# Create a mock resource
@resource = stub 'resource'
- @provider = provider_class.new(@resource)
-
@authname = "foo.spam.eggs.puppettest"
@authplist = {}
@rules = {@authname => @authplist}
- @authdb = {}
- @authdb["rules"] = @rules
+
+ authdb = {}
+ authdb["rules"] = { "foorule" => "foo" }
+ authdb["rights"] = { "fooright" => "foo" }
+
+ # Stub out Plist::parse_xml
+ Plist.stubs(:parse_xml).returns(authdb)
# A catch all; no parameters set
@resource.stubs(:[]).returns(nil)
# But set name, ensure
@resource.stubs(:[]).with(:name).returns @authname
-
@resource.stubs(:[]).with(:ensure).returns :present
-
@resource.stubs(:ref).returns "MacAuthorization[#{@authname}]"
- # stub out the provider methods that actually touch the filesystem
- # or execute commands
- @provider.stubs(:populate_rules_rights).returns("")
-
- # Stub out Plist::parse_xml
- Plist.stubs("parse_xml").returns(@authdb)
+ @provider = provider_class.new(@resource)
end
it "should have a create method" do
@@ -60,9 +56,9 @@ describe provider_class do
end
properties = [ :allow_root, :authenticate_user, :auth_class, :comment,
- :group, :k_of_n, :mechanisms, :rule, :session_owner,
- :shared, :timeout, :tries, :auth_type ]
-
+ :group, :k_of_n, :mechanisms, :rule, :session_owner,
+ :shared, :timeout, :tries, :auth_type ]
+
properties.each do |prop|
it "should have a #{prop.to_s} method" do
@provider.should respond_to(prop.to_s)
@@ -79,7 +75,7 @@ describe provider_class do
end
it "should call the internal method destroy_right" do
- @provider.expects("destroy_right")
+ @provider.expects(:destroy_right)
@provider.destroy
end
it "should call the external command 'security authorizationdb remove @authname" do
@@ -94,7 +90,7 @@ describe provider_class do
end
it "should call the internal method destroy_rule" do
- @provider.expects("destroy_rule")
+ @provider.expects(:destroy_rule)
@provider.destroy
end
end
@@ -105,12 +101,12 @@ describe provider_class do
end
it "should call the internal method flush_right" do
- @provider.expects("flush_right")
+ @provider.expects(:flush_right)
@provider.flush
end
it "should call the internal method set_right" do
- @provider.expects("set_right")
+ @provider.expects(:set_right)
@provider.flush
end
@@ -138,16 +134,14 @@ describe provider_class do
end
it "should call the internal method flush_rule" do
- @provider.expects("flush_rule")
+ @provider.expects(:flush_rule)
@provider.flush
end
it "should call the internal method set_rule" do
- @provider.expects("set_rule")
+ @provider.expects(:set_rule)
@provider.flush
end
end
-
-
end
\ No newline at end of file
diff --git a/spec/unit/type/macauthorization.rb b/spec/unit/type/macauthorization.rb
old mode 100644
new mode 100755
index a27841c..1c7f122
--- a/spec/unit/type/macauthorization.rb
+++ b/spec/unit/type/macauthorization.rb
@@ -4,77 +4,75 @@ require File.dirname(__FILE__) + '/../../spec_helper'
macauth_type = Puppet::Type.type(:macauthorization)
-
-describe macauth_type, "when validating attributes" do
-
- parameters = [:name,]
- properties = [:auth_type, :allow_root, :authenticate_user, :auth_class,
- :comment, :group, :k_of_n, :mechanisms, :rule,
- :session_owner, :shared, :timeout, :tries]
-
- parameters.each do |parameter|
- it "should have a %s parameter" % parameter do
- macauth_type.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
- end
-
- it "should have documentation for its %s parameter" % parameter do
- macauth_type.attrclass(parameter).doc.should be_instance_of(String)
- end
- end
-
- properties.each do |property|
- it "should have a %s property" % property do
- macauth_type.attrclass(property).ancestors.should be_include(Puppet::Property)
- end
-
- it "should have documentation for its %s property" % property do
- macauth_type.attrclass(property).doc.should be_instance_of(String)
- end
- end
-
-end
-
-describe macauth_type, "when validating properties" do
+describe Puppet.type(:macauthorization), "when checking macauthorization objects" do
before do
- @provider = stub 'provider'
- @resource = stub 'resource', :resource => nil, :provider => @provider, :line => nil, :file => nil
+ authplist = {}
+ authplist["rules"] = { "foorule" => "foo" }
+ authplist["rights"] = { "fooright" => "foo" }
+ provider_class = macauth_type.provider(macauth_type.providers[0])
+ Plist.stubs(:parse_xml).with("/etc/authorization").returns(authplist)
+ macauth_type.stubs(:defaultprovider).returns provider_class
end
after do
macauth_type.clear
end
+
- it "should have a default provider inheriting from Puppet::Provider" do
- macauth_type.defaultprovider.ancestors.should be_include(Puppet::Provider)
- end
-
- it "should be able to create a instance" do
- macauth_type.create(:name => "foo").should_not be_nil
- end
+ describe "when validating attributes" do
+
+ parameters = [:name,]
+ properties = [:auth_type, :allow_root, :authenticate_user, :auth_class,
+ :comment, :group, :k_of_n, :mechanisms, :rule,
+ :session_owner, :shared, :timeout, :tries]
+
+ parameters.each do |parameter|
+ it "should have a %s parameter" % parameter do
+ macauth_type.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+ end
+
+ it "should have documentation for its %s parameter" % parameter do
+ macauth_type.attrclass(parameter).doc.should be_instance_of(String)
+ end
+ end
+
+ properties.each do |property|
+ it "should have a %s property" % property do
+ macauth_type.attrclass(property).ancestors.should be_include(Puppet::Property)
+ end
+
+ it "should have documentation for its %s property" % property do
+ macauth_type.attrclass(property).doc.should be_instance_of(String)
+ end
+ end
- it "should be able to create an instance" do
- lambda {
- macauth_type.create(:name => 'foo')
- }.should_not raise_error
- end
-
- it "should support :present as a value to :ensure" do
- lambda {
- macauth_type.create(:name => "foo", :ensure => :present)
- }.should_not raise_error
end
-
- it "should support :absent as a value to :ensure" do
- lambda {
- macauth_type.create(:name => "foo", :ensure => :absent)
- }.should_not raise_error
+
+ describe "when validating properties" do
+
+ it "should have a default provider inheriting from Puppet::Provider" do
+ macauth_type.defaultprovider.ancestors.should be_include(Puppet::Provider)
+ end
+
+ it "should be able to create an instance" do
+ lambda {
+ macauth_type.create(:name => 'foo')
+ }.should_not raise_error
+ end
+
+ it "should support :present as a value to :ensure" do
+ lambda {
+ macauth_type.create(:name => "foo", :ensure => :present)
+ }.should_not raise_error
+ end
+
+ it "should support :absent as a value to :ensure" do
+ lambda {
+ macauth_type.create(:name => "foo", :ensure => :absent)
+ }.should_not raise_error
+ end
+
end
-end
-
-describe "instances" do
- it "should have a valid provider" do
- macauth_type.create(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider)
- end
end
\ No newline at end of file
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list