[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Daniel Pittman daniel at rimspace.net
Tue May 10 08:05:46 UTC 2011


The following commit has been merged in the experimental branch:
commit 3954576bca044e4fa9c3d74047fdd0833be0c5b6
Author: Daniel Pittman <daniel at rimspace.net>
Date:   Thu Mar 3 00:40:50 2011 -0800

    (#6582) eliminate fakeresource use in ssh_authorized_key spec.
    
    We replace it with an instance of the actual resource we are testing, which
    reduces the number of ways this code is tied to the specific implementation.
    
    Reviewed-By: Nick Lewis <nick at puppetlabs.com>

diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb
index 3ed4799..048d77b 100755
--- a/spec/unit/provider/host/parsed_spec.rb
+++ b/spec/unit/provider/host/parsed_spec.rb
@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
 
 require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+require 'shared_behaviours/all_parsedfile_providers'
 
 require 'puppet_spec/files'
 
diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
index 6d67ee3..7a1bd77 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
@@ -1,15 +1,13 @@
 #!/usr/bin/env ruby
 
 require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
-
+require 'shared_behaviours/all_parsedfile_providers'
 require 'puppet_spec/files'
-require 'puppettest/fakes'
 
 provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed)
 
 describe provider_class do
   include PuppetSpec::Files
-  include PuppetTest
 
   before :each do
     @sshauthkey_class = Puppet::Type.type(:ssh_authorized_key)
@@ -25,15 +23,13 @@ describe provider_class do
   end
 
   def mkkey(args)
-    fakeresource = fakeresource(:ssh_authorized_key, args[:name])
-    fakeresource.stubs(:should).with(:user).returns @user
-    fakeresource.stubs(:should).with(:target).returns @keyfile
-
-    key = @provider.new(fakeresource)
+    args[:target] = @keyfile
+    args[:user]   = @user
+    resource = Puppet::Type.type(:ssh_authorized_key).new(args)
+    key = @provider.new(resource)
     args.each do |p,v|
       key.send(p.to_s + "=", v)
     end
-
     key
   end
 
@@ -50,30 +46,24 @@ describe provider_class do
 
   it "should be able to generate a basic authorized_keys file" do
 
-    key = mkkey(
-      {
-        :name => "Just Testing",
-        :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
-        :type => "ssh-dss",
-        :ensure => :present,
-
-        :options => [:absent]
-    })
+    key = mkkey(:name    => "Just Testing",
+                :key     => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
+                :type    => "ssh-dss",
+                :ensure  => :present,
+                :options => [:absent]
+              )
 
     genkey(key).should == "ssh-dss AAAAfsfddsjldjgksdflgkjsfdlgkj Just Testing\n"
   end
 
   it "should be able to generate a authorized_keys file with options" do
 
-    key = mkkey(
-      {
-        :name => "root at localhost",
-        :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
-        :type => "ssh-rsa",
-        :ensure => :present,
-
-        :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"]
-    })
+    key = mkkey(:name    => "root at localhost",
+                :key     => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
+                :type    => "ssh-rsa",
+                :ensure  => :present,
+                :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"]
+                )
 
     genkey(key).should == "from=\"192.168.1.1\",no-pty,no-X11-forwarding ssh-rsa AAAAfsfddsjldjgksdflgkjsfdlgkj root at localhost\n"
   end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list