summaryrefslogtreecommitdiff
path: root/spec/unit/ssl/inventory_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/ssl/inventory_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-upstream/3.7.0.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/ssl/inventory_spec.rb')
-rwxr-xr-xspec/unit/ssl/inventory_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/ssl/inventory_spec.rb b/spec/unit/ssl/inventory_spec.rb
index 6e4fbd340..879fd90d1 100755
--- a/spec/unit/ssl/inventory_spec.rb
+++ b/spec/unit/ssl/inventory_spec.rb
@@ -133,5 +133,18 @@ describe Puppet::SSL::Inventory, :unless => Puppet.features.microsoft_windows? d
@inventory.serial("me").should == 15
end
end
+
+ describe "and finding all serial numbers" do
+ it "should return nil if the inventory file is missing" do
+ Puppet::FileSystem.expects(:exist?).with(cert_inventory).returns false
+ @inventory.serials(:whatever).should be_empty
+ end
+
+ it "should return the all the serial numbers from the lines matching the provided name" do
+ File.expects(:readlines).with(cert_inventory).returns ["0x00f blah blah /CN=me\n", "0x001 blah blah /CN=you\n", "0x002 blah blah /CN=me\n"]
+
+ @inventory.serials("me").should == [15, 2]
+ end
+ end
end
end