diff options
author | Stig Sandbeck Mathisen <ssm@debian.org> | 2014-09-07 10:14:36 +0200 |
---|---|---|
committer | Stig Sandbeck Mathisen <ssm@debian.org> | 2014-09-07 10:14:36 +0200 |
commit | d4b83be375ac1dead058e091191ee7c7b7c24c8a (patch) | |
tree | dc825687392ae3068de5b764be60c53122d9e02a /spec/unit/ssl/certificate_authority_spec.rb | |
parent | 229cbb976fe0f70f5f30548b83517b415840f9bb (diff) | |
parent | 1681684857c6e39d60d87b0b3520d8783977ceff (diff) | |
download | puppet-upstream/3.7.0.tar.gz |
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/ssl/certificate_authority_spec.rb')
-rwxr-xr-x | spec/unit/ssl/certificate_authority_spec.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index ef5a86862..2881b0a1e 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -7,7 +7,6 @@ require 'puppet/ssl/certificate_authority' describe Puppet::SSL::CertificateAuthority do after do Puppet::SSL::CertificateAuthority.instance_variable_set(:@singleton_instance, nil) - Puppet.settings.clearused end def stub_ca_host @@ -937,12 +936,36 @@ describe Puppet::SSL::CertificateAuthority do cert = stub 'cert', :content => real_cert Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns nil - @ca.inventory.expects(:serial).with("host").returns 16 + @ca.inventory.expects(:serials).with("host").returns [16] @ca.crl.expects(:revoke).with { |serial, key| serial == 16 } @ca.revoke('host') end + it "should revoke all serials matching a name" do + real_cert = stub 'real_cert', :serial => 15 + cert = stub 'cert', :content => real_cert + Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns nil + + @ca.inventory.expects(:serials).with("host").returns [16, 20, 25] + + @ca.crl.expects(:revoke).with { |serial, key| serial == 16 } + @ca.crl.expects(:revoke).with { |serial, key| serial == 20 } + @ca.crl.expects(:revoke).with { |serial, key| serial == 25 } + @ca.revoke('host') + end + + it "should raise an error if no certificate match" do + real_cert = stub 'real_cert', :serial => 15 + cert = stub 'cert', :content => real_cert + Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns nil + + @ca.inventory.expects(:serials).with("host").returns [] + + @ca.crl.expects(:revoke).never + expect { @ca.revoke('host') }.to raise_error + end + context "revocation by serial number (#16798)" do it "revokes when given a lower case hexadecimal formatted string" do @ca.crl.expects(:revoke).with { |serial, key| serial == 15 } |