summaryrefslogtreecommitdiffstats
path: root/spec/integration/ssl/host_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration/ssl/host_spec.rb')
-rwxr-xr-xspec/integration/ssl/host_spec.rb114
1 files changed, 57 insertions, 57 deletions
diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb
index 5f2f1e5a4..9b4152e83 100755
--- a/spec/integration/ssl/host_spec.rb
+++ b/spec/integration/ssl/host_spec.rb
@@ -9,82 +9,82 @@ require 'puppet/ssl/host'
require 'tempfile'
describe Puppet::SSL::Host do
- before do
- # Get a safe temporary file
- file = Tempfile.new("host_integration_testing")
- @dir = file.path
- file.delete
+ before do
+ # Get a safe temporary file
+ file = Tempfile.new("host_integration_testing")
+ @dir = file.path
+ file.delete
- Puppet.settings[:confdir] = @dir
- Puppet.settings[:vardir] = @dir
+ Puppet.settings[:confdir] = @dir
+ Puppet.settings[:vardir] = @dir
- Puppet::SSL::Host.ca_location = :local
+ Puppet::SSL::Host.ca_location = :local
- @host = Puppet::SSL::Host.new("luke.madstop.com")
- @ca = Puppet::SSL::CertificateAuthority.new
- end
+ @host = Puppet::SSL::Host.new("luke.madstop.com")
+ @ca = Puppet::SSL::CertificateAuthority.new
+ end
- after {
- Puppet::SSL::Host.ca_location = :none
+ after {
+ Puppet::SSL::Host.ca_location = :none
- system("rm -rf #{@dir}")
- Puppet.settings.clear
- Puppet::Util::Cacher.expire
- }
+ system("rm -rf #{@dir}")
+ Puppet.settings.clear
+ Puppet::Util::Cacher.expire
+ }
- it "should be considered a CA host if its name is equal to 'ca'" do
- Puppet::SSL::Host.new(Puppet::SSL::CA_NAME).should be_ca
- end
+ it "should be considered a CA host if its name is equal to 'ca'" do
+ Puppet::SSL::Host.new(Puppet::SSL::CA_NAME).should be_ca
+ end
- describe "when managing its key" do
- it "should be able to generate and save a key" do
- @host.generate_key
- end
+ describe "when managing its key" do
+ it "should be able to generate and save a key" do
+ @host.generate_key
+ end
- it "should save the key such that the Indirector can find it" do
- @host.generate_key
+ it "should save the key such that the Indirector can find it" do
+ @host.generate_key
- Puppet::SSL::Key.find(@host.name).content.to_s.should == @host.key.to_s
- end
+ Puppet::SSL::Key.find(@host.name).content.to_s.should == @host.key.to_s
+ end
- it "should save the private key into the :privatekeydir" do
- @host.generate_key
- File.read(File.join(Puppet.settings[:privatekeydir], "luke.madstop.com.pem")).should == @host.key.to_s
- end
+ it "should save the private key into the :privatekeydir" do
+ @host.generate_key
+ File.read(File.join(Puppet.settings[:privatekeydir], "luke.madstop.com.pem")).should == @host.key.to_s
end
+ end
- describe "when managing its certificate request" do
- it "should be able to generate and save a certificate request" do
- @host.generate_certificate_request
- end
+ describe "when managing its certificate request" do
+ it "should be able to generate and save a certificate request" do
+ @host.generate_certificate_request
+ end
- it "should save the certificate request such that the Indirector can find it" do
- @host.generate_certificate_request
+ it "should save the certificate request such that the Indirector can find it" do
+ @host.generate_certificate_request
- Puppet::SSL::CertificateRequest.find(@host.name).content.to_s.should == @host.certificate_request.to_s
- end
+ Puppet::SSL::CertificateRequest.find(@host.name).content.to_s.should == @host.certificate_request.to_s
+ end
- it "should save the private certificate request into the :privatekeydir" do
- @host.generate_certificate_request
- File.read(File.join(Puppet.settings[:requestdir], "luke.madstop.com.pem")).should == @host.certificate_request.to_s
- end
+ it "should save the private certificate request into the :privatekeydir" do
+ @host.generate_certificate_request
+ File.read(File.join(Puppet.settings[:requestdir], "luke.madstop.com.pem")).should == @host.certificate_request.to_s
end
+ end
- describe "when the CA host" do
- it "should never store its key in the :privatekeydir" do
- Puppet.settings.use(:main, :ssl, :ca)
- @ca = Puppet::SSL::Host.new(Puppet::SSL::Host.ca_name)
- @ca.generate_key
+ describe "when the CA host" do
+ it "should never store its key in the :privatekeydir" do
+ Puppet.settings.use(:main, :ssl, :ca)
+ @ca = Puppet::SSL::Host.new(Puppet::SSL::Host.ca_name)
+ @ca.generate_key
- FileTest.should_not be_exist(File.join(Puppet[:privatekeydir], "ca.pem"))
- end
+ FileTest.should_not be_exist(File.join(Puppet[:privatekeydir], "ca.pem"))
end
+ end
- it "should pass the verification of its own SSL store" do
- @host.generate
- @ca = Puppet::SSL::CertificateAuthority.new
- @ca.sign(@host.name)
+ it "should pass the verification of its own SSL store" do
+ @host.generate
+ @ca = Puppet::SSL::CertificateAuthority.new
+ @ca.sign(@host.name)
- @host.ssl_store.verify(@host.certificate.content).should be_true
- end
+ @host.ssl_store.verify(@host.certificate.content).should be_true
+ end
end