summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorKylo Ginsberg <kylo@puppetlabs.com>2014-10-15 11:03:11 -0700
committerKylo Ginsberg <kylo@puppetlabs.com>2014-10-15 11:03:11 -0700
commita8060647f705ee2b2db766bd2b87963ee6f5adbd (patch)
tree8b1b4a2e3f7fd22a6e8ccb94b32e9d3110fd385d /spec/unit
parent5b5add89d387d945abab2930f841865c5d0396ea (diff)
parent2a0eaac7321f199e023fd9500cfab64cfd6544ce (diff)
downloadpuppet-a8060647f705ee2b2db766bd2b87963ee6f5adbd.tar.gz
Merge pull request #3164 from ffrank/ticket/3.7.x/PUP-3357-purge-unnamed-ssh-keys
(PUP-3357) purge unnamed ssh keys
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/provider/ssh_authorized_key/parsed_spec.rb15
-rwxr-xr-xspec/unit/type/user_spec.rb5
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
index 2e88c57df..78abec901 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
@@ -136,6 +136,21 @@ describe provider_class, :unless => Puppet.features.microsoft_windows? do
end
end
+ describe "prefetch_hook" do
+ let(:path) { '/path/to/keyfile' }
+ let(:input) do
+ { :type => 'rsa',
+ :key => 'KEYDATA',
+ :name => '',
+ :record_type => :parsed,
+ :target => path,
+ }
+ end
+ it "adds an indexed name to unnamed resources" do
+ @provider_class.prefetch_hook([input])[0][:name].should =~ /^#{path}:unnamed-\d+/
+ end
+ end
+
end
describe provider_class, :unless => Puppet.features.microsoft_windows? do
diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb
index f5a351752..974054309 100755
--- a/spec/unit/type/user_spec.rb
+++ b/spec/unit/type/user_spec.rb
@@ -501,6 +501,11 @@ describe Puppet::Type.type(:user) do
names = resources.collect { |res| res.name }
names.should_not include("keyname3")
end
+ it "should generate names for unnamed keys" do
+ names = resources.collect { |res| res.name }
+ fixture_path = File.join(my_fixture_dir, 'authorized_keys')
+ names.should include("#{fixture_path}:unnamed-1")
+ end
it "should each have a value for the user property" do
resources.map { |res|
res[:user]