diff options
| author | Kylo Ginsberg <kylo@puppetlabs.com> | 2014-10-15 11:03:11 -0700 |
|---|---|---|
| committer | Kylo Ginsberg <kylo@puppetlabs.com> | 2014-10-15 11:03:11 -0700 |
| commit | a8060647f705ee2b2db766bd2b87963ee6f5adbd (patch) | |
| tree | 8b1b4a2e3f7fd22a6e8ccb94b32e9d3110fd385d /spec/unit | |
| parent | 5b5add89d387d945abab2930f841865c5d0396ea (diff) | |
| parent | 2a0eaac7321f199e023fd9500cfab64cfd6544ce (diff) | |
| download | puppet-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-x | spec/unit/provider/ssh_authorized_key/parsed_spec.rb | 15 | ||||
| -rwxr-xr-x | spec/unit/type/user_spec.rb | 5 |
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] |
