summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/integration/defaults.rb26
-rw-r--r--spec/integration/network/server/webrick.rb1
-rwxr-xr-xspec/integration/ssl/certificate_authority.rb13
-rw-r--r--spec/unit/network/http/webrick.rb6
-rwxr-xr-xspec/unit/ssl/certificate_authority.rb11
5 files changed, 48 insertions, 9 deletions
diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb
new file mode 100755
index 000000000..f6ef74715
--- /dev/null
+++ b/spec/integration/defaults.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../spec_helper'
+
+require 'puppet/defaults'
+
+describe "Puppet defaults" do
+ describe "when configuring the :crl" do
+ after { Puppet.settings.clear }
+
+ it "should have a :crl setting" do
+ Puppet.settings.should be_valid(:crl)
+ end
+
+ it "should warn if :cacrl is set to false" do
+ Puppet.expects(:warning)
+ Puppet.settings[:cacrl] = 'false'
+ end
+
+ it "should set :crl to 'false' if :cacrl is set to false" do
+ crl = Puppet.settings[:cacrl]
+ Puppet.settings[:cacrl] = 'false'
+ Puppet.settings[:crl].should == false
+ end
+ end
+end
diff --git a/spec/integration/network/server/webrick.rb b/spec/integration/network/server/webrick.rb
index bcfdc16ea..ee307bca3 100644
--- a/spec/integration/network/server/webrick.rb
+++ b/spec/integration/network/server/webrick.rb
@@ -7,6 +7,7 @@ describe Puppet::Network::Server do
describe "when using webrick" do
before :each do
Puppet[:servertype] = 'webrick'
+ Puppet[:hostcrl] = 'false'
@params = { :address => "127.0.0.1", :port => 34343, :handlers => [ :node ] }
# Get a safe temporary file
diff --git a/spec/integration/ssl/certificate_authority.rb b/spec/integration/ssl/certificate_authority.rb
index 51e4a0aef..f7eb0f46a 100755
--- a/spec/integration/ssl/certificate_authority.rb
+++ b/spec/integration/ssl/certificate_authority.rb
@@ -11,7 +11,7 @@ require 'tempfile'
describe Puppet::SSL::CertificateAuthority do
before do
# Get a safe temporary file
- file = Tempfile.new("host_integration_testing")
+ file = Tempfile.new("ca_integration_testing")
@dir = file.path
file.delete
@@ -60,6 +60,17 @@ describe Puppet::SSL::CertificateAuthority do
end
end
+ it "should not have a CRL when :crl is set to false" do
+ Puppet.settings[:crl] = false
+ @ca.crl.should be_nil
+ end
+
+ it "should have a CRL when :crl is set to true" do
+ Puppet.settings[:crl] = true
+ @ca.generate_ca_certificate
+ @ca.crl.should_not be_nil
+ end
+
describe "when signing certificates" do
before do
@host = Puppet::SSL::Host.new("luke.madstop.com")
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb
index 1955c3e00..48b995c28 100644
--- a/spec/unit/network/http/webrick.rb
+++ b/spec/unit/network/http/webrick.rb
@@ -337,7 +337,7 @@ describe Puppet::Network::HTTP::WEBrick do
it "should specify the path to the CA certificate" do
Puppet.settings.stubs(:value).returns "whatever"
- Puppet.settings.stubs(:value).with(:cacrl).returns 'false'
+ Puppet.settings.stubs(:value).with(:hostcrl).returns 'false'
Puppet.settings.stubs(:value).with(:localcacert).returns '/ca/crt'
@server.setup_ssl[:SSLCACertificateFile].should == "/ca/crt"
@@ -357,7 +357,7 @@ describe Puppet::Network::HTTP::WEBrick do
it "should add an x509 store if the CRL is enabled" do
Puppet.settings.stubs(:value).returns "whatever"
- Puppet.settings.stubs(:value).with(:cacrl).returns '/my/crl'
+ Puppet.settings.stubs(:value).with(:hostcrl).returns '/my/crl'
@server.expects(:setup_ssl_store).returns("mystore")
@@ -366,7 +366,7 @@ describe Puppet::Network::HTTP::WEBrick do
it "should not add an x509 store if the CRL is disabled" do
Puppet.settings.stubs(:value).returns "whatever"
- Puppet.settings.stubs(:value).with(:cacrl).returns 'false'
+ Puppet.settings.stubs(:value).with(:hostcrl).returns 'false'
@server.expects(:setup_ssl_store).never
diff --git a/spec/unit/ssl/certificate_authority.rb b/spec/unit/ssl/certificate_authority.rb
index 09aaeabcf..424f47512 100755
--- a/spec/unit/ssl/certificate_authority.rb
+++ b/spec/unit/ssl/certificate_authority.rb
@@ -72,16 +72,16 @@ describe Puppet::SSL::CertificateAuthority do
end
describe "and the CRL is disabled" do
- it "should return nil when the :cacrl is false" do
- Puppet.settings.stubs(:value).with(:cacrl).returns false
+ it "should return nil when the :crl is false" do
+ Puppet.settings.stubs(:value).with(:crl).returns false
Puppet::SSL::CertificateRevocationList.expects(:new).never
@ca.crl.should be_nil
end
- it "should return nil when the :cacrl is 'false'" do
- Puppet.settings.stubs(:value).with(:cacrl).returns 'false'
+ it "should return nil when the :crl is 'false'" do
+ Puppet.settings.stubs(:value).with(:crl).returns false
Puppet::SSL::CertificateRevocationList.expects(:new).never
@@ -105,13 +105,14 @@ describe Puppet::SSL::CertificateAuthority do
@ca.crl.should equal(crl)
end
- it "should create and generate a new CRL instance of no CRL can be found" do
+ it "should create, generate, and save a new CRL instance of no CRL can be found" do
crl = mock 'crl'
Puppet::SSL::CertificateRevocationList.expects(:find).returns nil
Puppet::SSL::CertificateRevocationList.expects(:new).returns crl
crl.expects(:generate).with(@ca.host.certificate.content)
+ crl.expects(:save)
@ca.crl.should equal(crl)
end