diff options
author | Luke Kanies <luke@madstop.com> | 2009-02-14 18:10:37 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-02-14 18:10:37 -0600 |
commit | e87de9d8f3be325fb0495dd5c64e08625333924f (patch) | |
tree | 8a7ed2ff7e375f3c0c91623de1ccf8b71a1d7317 /spec | |
parent | 487b9b1a3e8b9207a9910bc5eaeeb75cb3e4abe5 (diff) | |
parent | 24d48e6c07ef634971fcb8ed5b27258db161a018 (diff) | |
download | puppet-e87de9d8f3be325fb0495dd5c64e08625333924f.tar.gz puppet-e87de9d8f3be325fb0495dd5c64e08625333924f.tar.xz puppet-e87de9d8f3be325fb0495dd5c64e08625333924f.zip |
Merge branch '0.24.x'
Conflicts:
test/ral/manager/type.rb
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/network/xmlrpc/client.rb | 4 | ||||
-rwxr-xr-x | spec/unit/provider/parsedfile.rb | 15 | ||||
-rwxr-xr-x | spec/unit/provider/service/launchd.rb | 10 | ||||
-rwxr-xr-x | spec/unit/type/user.rb | 12 |
4 files changed, 31 insertions, 10 deletions
diff --git a/spec/unit/network/xmlrpc/client.rb b/spec/unit/network/xmlrpc/client.rb index 36e59429c..328688bae 100755 --- a/spec/unit/network/xmlrpc/client.rb +++ b/spec/unit/network/xmlrpc/client.rb @@ -109,7 +109,7 @@ describe Puppet::Network::XMLRPCClient do it "should log, recycle the connection, and retry if Errno::EPIPE is raised" do @client.expects(:call).times(2).raises(Errno::EPIPE).then.returns "eh" - Puppet.expects(:warning) + Puppet.expects(:info) @client.expects(:recycle_connection) @client.report("eh") @@ -118,7 +118,7 @@ describe Puppet::Network::XMLRPCClient do it "should log, recycle the connection, and retry if EOFError is raised" do @client.expects(:call).times(2).raises(EOFError).then.returns "eh" - Puppet.expects(:warning) + Puppet.expects(:info) @client.expects(:recycle_connection) @client.report("eh") diff --git a/spec/unit/provider/parsedfile.rb b/spec/unit/provider/parsedfile.rb index 11a91c8d7..f20b6b235 100755 --- a/spec/unit/provider/parsedfile.rb +++ b/spec/unit/provider/parsedfile.rb @@ -56,18 +56,27 @@ describe Puppet::Provider::ParsedFile do @class.initvars @class.prefetch - @filetype = mock 'filetype' - Puppet::Util::FileType.filetype(:flat).expects(:new).with("/my/file").returns @filetype + @filetype = Puppet::Util::FileType.filetype(:flat).new("/my/file") + Puppet::Util::FileType.filetype(:flat).stubs(:new).with("/my/file").returns @filetype @filetype.stubs(:write) end - it "should back up the file being written" do + it "should back up the file being written if the filetype can be backed up" do @filetype.expects(:backup) @class.flush_target("/my/file") end + it "should not try to back up the file if the filetype cannot be backed up" do + @filetype = Puppet::Util::FileType.filetype(:ram).new("/my/file") + Puppet::Util::FileType.filetype(:flat).expects(:new).returns @filetype + + @filetype.stubs(:write) + + @class.flush_target("/my/file") + end + it "should not back up the file more than once between calls to 'prefetch'" do @filetype.expects(:backup).once diff --git a/spec/unit/provider/service/launchd.rb b/spec/unit/provider/service/launchd.rb index cc2dae190..f2d69a47b 100755 --- a/spec/unit/provider/service/launchd.rb +++ b/spec/unit/provider/service/launchd.rb @@ -62,9 +62,17 @@ describe provider_class do describe "when checking status" do it "should call the external command 'launchctl list' once" do - @provider.expects(:launchctl).with(:list, @resource[:name]).returns(:running).once + @provider.expects(:launchctl).with(:list).returns("rotating-strawberry-madonnas") @provider.status end + it "should return stopped if not listed in launchctl list output" do + @provider.stubs(:launchctl).with(:list).returns("rotating-strawberry-madonnas") + assert_equal @provider.status, :stopped + end + it "should return running if listed in launchctl list output" do + @provider.stubs(:launchctl).with(:list).returns(@joblabel) + assert_equal @provider.status, :running + end end describe "when starting the service" do diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb index 2e8616ce8..5c46689d3 100755 --- a/spec/unit/type/user.rb +++ b/spec/unit/type/user.rb @@ -38,10 +38,6 @@ describe user do it "should have a valid provider" do user.new(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider) end - - it "should fail if a ':' is included in the password" do - lambda { user.create(:name => "foo", :password => 'some:thing') }.should raise_error(Puppet::Error) - end end properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :groups, :roles, :auths, :profiles, :project, :keys] @@ -232,6 +228,14 @@ describe user do it "should not include the password in the change log when changing the password" do @password.change_to_s("other", "mypass").should_not be_include("mypass") end + + it "should fail if a ':' is included in the password" do + lambda { @password.should = "some:thing" }.should raise_error(ArgumentError) + end + + it "should allow the value to be set to :absent" do + lambda { @password.should = :absent }.should_not raise_error + end end describe "when manages_solaris_rbac is enabled" do |