diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-05 18:39:19 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-06 16:37:08 -0700 |
commit | a03790d82a2c190d6f00ee7677617a7be04aa85d (patch) | |
tree | 0aac739e7554a7a7b7e65ccb5788efb16594d475 /spec | |
parent | 7e7d246bf46349c904c76a31951d4a40c200790b (diff) | |
download | puppet-a03790d82a2c190d6f00ee7677617a7be04aa85d.tar.gz puppet-a03790d82a2c190d6f00ee7677617a7be04aa85d.tar.xz puppet-a03790d82a2c190d6f00ee7677617a7be04aa85d.zip |
(#6972) Handle ca-location in the certificate string.
This ports the existing certificate location configuration to be a string
option, and then uses that to change the configuration. This will leak state
between calls, which is somewhat unavoidable, but should at least get the
basic stuff right for the CLI.
We eventually need the CA string to be supported by a stateless internal CA
implementation that allows us to do the right thing overall.
Reviewed-By: Dan Bode <dan@puppetlabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/application/certificate_spec.rb | 16 | ||||
-rwxr-xr-x | spec/unit/string/certificate_spec.rb | 14 |
2 files changed, 21 insertions, 9 deletions
diff --git a/spec/unit/application/certificate_spec.rb b/spec/unit/application/certificate_spec.rb index 6666f54f7..3d2215ded 100755 --- a/spec/unit/application/certificate_spec.rb +++ b/spec/unit/application/certificate_spec.rb @@ -4,13 +4,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') require 'puppet/application/certificate' describe Puppet::Application::Certificate do - it "should be a subclass of Puppet::Application::IndirectionBase" do - Puppet::Application::Certificate.superclass.should equal( - Puppet::Application::IndirectionBase - ) + it "should have a 'ca-location' option" do + # REVISIT: This is delegated from the string, and we will have a test + # there, so is this actually a valuable test? + subject.command_line.stubs(:args).returns %w{list} + subject.preinit + subject.should respond_to(:handle_ca_location) end - it "should have a 'ca' option" do - Puppet::Application::Certificate.new.should respond_to(:handle_ca_location) + it "should accept the ca-location option" do + subject.command_line.stubs(:args).returns %w{--ca-location local list} + subject.preinit and subject.parse_options and subject.setup + subject.arguments.should == [{ :ca_location => "local" }] end end diff --git a/spec/unit/string/certificate_spec.rb b/spec/unit/string/certificate_spec.rb index f6d53688b..4afd581bf 100755 --- a/spec/unit/string/certificate_spec.rb +++ b/spec/unit/string/certificate_spec.rb @@ -1,6 +1,14 @@ -#!/usr/bin/env ruby - -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'puppet/ssl/host' describe Puppet::String[:certificate, '0.0.1'] do + it "should have a ca-location option" do + subject.should be_option :ca_location + end + + it "should set the ca location when invoked" do + pending "The string itself is broken in this release." + Puppet::SSL::Host.expects(:ca_location=).with(:foo) + Puppet::SSL::Host.indirection.expects(:search) + subject.list :ca_location => :foo + end end |