summaryrefslogtreecommitdiffstats
path: root/spec/unit/ssl/certificate_request.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-09-18 12:54:03 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-11-20 07:27:21 +1100
commit2d137e2e1ce603ee2727d66b1aba57458bf4d1be (patch)
tree44660e699774dd54a6c721cac514cf41a2a543c9 /spec/unit/ssl/certificate_request.rb
parent089ac3e37dd1418751bc4dfe152e09fbacbc5122 (diff)
downloadpuppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.tar.gz
puppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.tar.xz
puppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.zip
Fixing #1507 - Adding a :ca_name setting
This allows one to specify the name to use in the CA certificate. It defaults to the :certname, but for those stuck using mod_ssl it can be changed. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/ssl/certificate_request.rb')
-rwxr-xr-xspec/unit/ssl/certificate_request.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/ssl/certificate_request.rb b/spec/unit/ssl/certificate_request.rb
index 85e1d5470..29bbc7bc1 100755
--- a/spec/unit/ssl/certificate_request.rb
+++ b/spec/unit/ssl/certificate_request.rb
@@ -117,6 +117,21 @@ describe Puppet::SSL::CertificateRequest do
@instance.generate(@key)
end
+ it "should set the CN to the CSR name when the CSR is not for a CA" do
+ subject = mock 'subject'
+ OpenSSL::X509::Name.expects(:new).with { |subject| subject[0][1] == @instance.name }.returns(subject)
+ @request.expects(:subject=).with(subject)
+ @instance.generate(@key)
+ end
+
+ it "should set the CN to the :ca_name setting when the CSR is for a CA" do
+ subject = mock 'subject'
+ Puppet.settings.expects(:value).with(:ca_name).returns "mycertname"
+ OpenSSL::X509::Name.expects(:new).with { |subject| subject[0][1] == "mycertname" }.returns(subject)
+ @request.expects(:subject=).with(subject)
+ Puppet::SSL::CertificateRequest.new(Puppet::SSL::CA_NAME).generate(@key)
+ end
+
it "should set the version to 0" do
@request.expects(:version=).with(0)
@instance.generate(@key)