summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-17 18:09:33 -0500
committerLuke Kanies <luke@madstop.com>2008-04-17 18:09:33 -0500
commitd8bb81eabb6ad85d985ae7407e4260e800a0cf30 (patch)
tree191ae32ee0ee0a1ae4c8e1fdfc8cc4446ee2d343 /spec/unit
parentcbe522169ed6eb2426ecf5a77e24e27b6f7a4edf (diff)
downloadpuppet-d8bb81eabb6ad85d985ae7407e4260e800a0cf30.tar.gz
puppet-d8bb81eabb6ad85d985ae7407e4260e800a0cf30.tar.xz
puppet-d8bb81eabb6ad85d985ae7407e4260e800a0cf30.zip
Moving all of the ca-specific settings to the ca_file
terminus classes, rather than the normal :file classes. This is unfortunately complicated, and it means that the Key :ca_file is only ever actually used for retrieving the CA key itself.
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/indirector/certificate/ca_file.rb9
-rwxr-xr-xspec/unit/indirector/certificate/file.rb9
-rwxr-xr-xspec/unit/indirector/key/ca_file.rb34
-rwxr-xr-xspec/unit/indirector/key/file.rb9
4 files changed, 43 insertions, 18 deletions
diff --git a/spec/unit/indirector/certificate/ca_file.rb b/spec/unit/indirector/certificate/ca_file.rb
index 98075170d..864bc87bd 100755
--- a/spec/unit/indirector/certificate/ca_file.rb
+++ b/spec/unit/indirector/certificate/ca_file.rb
@@ -16,4 +16,13 @@ describe Puppet::SSL::Certificate::CaFile do
Puppet.settings.expects(:value).with(:signeddir).returns "/cert/dir"
Puppet::SSL::Certificate::CaFile.collection_directory.should == "/cert/dir"
end
+
+ it "should store the ca certificate at the :cacert location" do
+ Puppet.settings.stubs(:use)
+ Puppet.settings.stubs(:value).returns "whatever"
+ Puppet.settings.stubs(:value).with(:cacert).returns "/ca/cert"
+ file = Puppet::SSL::Certificate::CaFile.new
+ file.stubs(:ca?).returns true
+ file.path("whatever").should == "/ca/cert"
+ end
end
diff --git a/spec/unit/indirector/certificate/file.rb b/spec/unit/indirector/certificate/file.rb
index ffaf12047..18fe9a1c3 100755
--- a/spec/unit/indirector/certificate/file.rb
+++ b/spec/unit/indirector/certificate/file.rb
@@ -16,13 +16,4 @@ describe Puppet::SSL::Certificate::File do
Puppet.settings.expects(:value).with(:certdir).returns "/cert/dir"
Puppet::SSL::Certificate::File.collection_directory.should == "/cert/dir"
end
-
- it "should store the ca certificate at the :cacert location" do
- Puppet.settings.stubs(:use)
- Puppet.settings.stubs(:value).returns "whatever"
- Puppet.settings.stubs(:value).with(:cacert).returns "/ca/cert"
- file = Puppet::SSL::Certificate::File.new
- file.stubs(:ca?).returns true
- file.path("whatever").should == "/ca/cert"
- end
end
diff --git a/spec/unit/indirector/key/ca_file.rb b/spec/unit/indirector/key/ca_file.rb
new file mode 100755
index 000000000..256c3b44a
--- /dev/null
+++ b/spec/unit/indirector/key/ca_file.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2008-3-7.
+# Copyright (c) 2007. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+require 'puppet/indirector/key/ca_file'
+
+describe Puppet::SSL::Key::CaFile do
+ it "should have documentation" do
+ Puppet::SSL::Key::CaFile.doc.should be_instance_of(String)
+ end
+
+ it "should store the ca key at the :cakey location" do
+ Puppet.settings.stubs(:use)
+ Puppet.settings.stubs(:value).returns "whatever"
+ Puppet.settings.stubs(:value).with(:cakey).returns "/ca/key"
+ file = Puppet::SSL::Key::CaFile.new
+ file.stubs(:ca?).returns true
+ file.path("whatever").should == "/ca/key"
+ end
+
+ describe "when choosing the path for the public key" do
+ it "should fail if the key is not for the CA" do
+ Puppet.settings.stubs(:use)
+ Puppet.settings.stubs(:value).returns "whatever"
+ Puppet.settings.stubs(:value).with(:cakey).returns "/ca/key"
+ file = Puppet::SSL::Key::CaFile.new
+ file.stubs(:ca?).returns false
+ lambda { file.path("whatever") }.should raise_error(ArgumentError)
+ end
+ end
+end
diff --git a/spec/unit/indirector/key/file.rb b/spec/unit/indirector/key/file.rb
index 8a1cb04bd..bd0c57c36 100755
--- a/spec/unit/indirector/key/file.rb
+++ b/spec/unit/indirector/key/file.rb
@@ -17,15 +17,6 @@ describe Puppet::SSL::Key::File do
Puppet::SSL::Key::File.collection_directory.should == "/key/dir"
end
- it "should store the ca key at the :cakey location" do
- Puppet.settings.stubs(:use)
- Puppet.settings.stubs(:value).returns "whatever"
- Puppet.settings.stubs(:value).with(:cakey).returns "/ca/key"
- file = Puppet::SSL::Key::File.new
- file.stubs(:ca?).returns true
- file.path("whatever").should == "/ca/key"
- end
-
describe "when choosing the path for the public key" do
it "should use the :capub setting location if the key is for the certificate authority" do
Puppet.settings.stubs(:value).returns "/fake/dir"