diff options
author | Luke Kanies <luke@madstop.com> | 2008-04-19 15:30:11 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-19 15:30:11 -0500 |
commit | 934fbba81cb18f05e07675d79a2e830c4e95c918 (patch) | |
tree | 271bc1b8f94904e24be6b4823b304ef8787f4e9e /spec/unit/ssl | |
parent | d4813f1e03d96551e91b104e48b028fb4074d398 (diff) | |
download | puppet-934fbba81cb18f05e07675d79a2e830c4e95c918.tar.gz puppet-934fbba81cb18f05e07675d79a2e830c4e95c918.tar.xz puppet-934fbba81cb18f05e07675d79a2e830c4e95c918.zip |
Making the SSL::Host's destroy method a class method,
rather than an instance method.
Diffstat (limited to 'spec/unit/ssl')
-rwxr-xr-x | spec/unit/ssl/host.rb | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/spec/unit/ssl/host.rb b/spec/unit/ssl/host.rb index d3756a016..b214aa44a 100755 --- a/spec/unit/ssl/host.rb +++ b/spec/unit/ssl/host.rb @@ -125,6 +125,36 @@ describe Puppet::SSL::Host do end end + it "should have a class method for destroying all files related to a given host" do + Puppet::SSL::Host.should respond_to(:destroy) + end + + describe "when destroying a host's SSL files" do + before do + Puppet::SSL::Key.stubs(:destroy).returns false + Puppet::SSL::Certificate.stubs(:destroy).returns false + Puppet::SSL::CertificateRequest.stubs(:destroy).returns false + end + + it "should destroy its certificate, certificate request, and key" do + Puppet::SSL::Key.expects(:destroy).with("myhost") + Puppet::SSL::Certificate.expects(:destroy).with("myhost") + Puppet::SSL::CertificateRequest.expects(:destroy).with("myhost") + + Puppet::SSL::Host.destroy("myhost") + end + + it "should return true if any of the classes returned true" do + Puppet::SSL::Certificate.expects(:destroy).with("myhost").returns true + + Puppet::SSL::Host.destroy("myhost").should be_true + end + + it "should return false if none of the classes returned true" do + Puppet::SSL::Host.destroy("myhost").should be_false + end + end + describe "when managing its private key" do before do @realkey = "mykey" @@ -229,22 +259,6 @@ describe Puppet::SSL::Host do end end - describe "when being destroyed" do - before do - @host.stubs(:key).returns Puppet::SSL::Key.new("myname") - @host.stubs(:certificate).returns Puppet::SSL::Certificate.new("myname") - @host.stubs(:certificate_request).returns Puppet::SSL::CertificateRequest.new("myname") - end - - it "should destroy its certificate, certificate request, and key" do - Puppet::SSL::Key.expects(:destroy).with(@host.name) - Puppet::SSL::Certificate.expects(:destroy).with(@host.name) - Puppet::SSL::CertificateRequest.expects(:destroy).with(@host.name) - - @host.destroy - end - end - it "should have a method for listing certificate hosts" do Puppet::SSL::Host.should respond_to(:search) end |