summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-09-18 12:09:44 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-09-22 09:23:38 +1000
commita1d3b04296babc42b6a00956508c86c18e2b39bc (patch)
treec26a9dc9cbe5b2a12b568f569dfa1aeee6328106 /spec/unit/indirector
parent8987509aa171101fc64d5166851e866752f41d8c (diff)
downloadpuppet-a1d3b04296babc42b6a00956508c86c18e2b39bc.tar.gz
puppet-a1d3b04296babc42b6a00956508c86c18e2b39bc.tar.xz
puppet-a1d3b04296babc42b6a00956508c86c18e2b39bc.zip
Fixing #2617 - use the cert name as specified
This allows us to search for a cert, and we use the searched-for term as the cert name (for the wrapper, not the actual cert object), rather than the real cert name. This allows us to use symbolic names like 'ca', as we're currently doing. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/indirector')
-rwxr-xr-xspec/unit/indirector/certificate/rest.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/unit/indirector/certificate/rest.rb b/spec/unit/indirector/certificate/rest.rb
index d5959c489..a3257543b 100755
--- a/spec/unit/indirector/certificate/rest.rb
+++ b/spec/unit/indirector/certificate/rest.rb
@@ -20,4 +20,38 @@ describe Puppet::SSL::Certificate::Rest do
it "should set port_setting to :ca_port" do
Puppet::SSL::Certificate::Rest.port_setting.should == :ca_port
end
+
+ it "should make sure found certificates have their names set to the search string" do
+ terminus = Puppet::SSL::Certificate::Rest.new
+
+ # This has 'boo.com' in the CN
+ cert_string = "-----BEGIN CERTIFICATE-----
+MIICPzCCAaigAwIBAgIBBDANBgkqhkiG9w0BAQUFADAWMRQwEgYDVQQDDAtidWNr
+eS5sb2NhbDAeFw0wOTA5MTcxNzI1MzJaFw0xNDA5MTYxNzI1MzJaMBIxEDAOBgNV
+BAMMB2Jvby5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKG9B+DkTCNh
+F5xHchNDfnbC9NzWKM600oxrr84pgUVAG6B2wAZcdfoEtXszhsY9Jzpwqkvxk4Mx
+AbYqo9+TCi4UoiH6e+vAKOOJD3DHrlf+/RW4hGtyaI41DBhf4+B4/oFz5PH9mvKe
+NSfHFI/yPW+1IXYjxKLQNwF9E7q3JbnzAgMBAAGjgaAwgZ0wOAYJYIZIAYb4QgEN
+BCsWKVB1cHBldCBSdWJ5L09wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMAwG
+A1UdEwEB/wQCMAAwHQYDVR0OBBYEFJOxEUeyf4cNOBmf9zIaE1JTuNdLMAsGA1Ud
+DwQEAwIFoDAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwME
+MA0GCSqGSIb3DQEBBQUAA4GBAFTJxKprMg6tfhGnvEvURPmlJrINn9c2b5Y4AGYp
+tO86PFFkWw/EIJvvJzbj3s+Butr+eUo//+f1xxX7UCwwGqGxKqjtVS219oU/wkx8
+h7rW4Xk7MrLl0auSS1p4wLcAMm+ZImf94+j8Cj+tkr8eGozZceRV13b8+EkdaE3S
+rn/G
+-----END CERTIFICATE-----
+"
+
+ network = stub 'network'
+ terminus.stubs(:network).returns network
+
+ response = stub 'response', :code => "200", :body => cert_string
+ response.stubs(:[]).with('content-type').returns "text/plain"
+ network.expects(:get).returns response
+
+ request = Puppet::Indirector::Request.new(:certificate, :find, "foo.com")
+ result = terminus.find(request)
+ result.should_not be_nil
+ result.name.should == "foo.com"
+ end
end