Sha256: fe4df2ac239b269f5b1fd6a35f1010a25ef61cbb6f0617dc25ba26e753166318

Contents?: true

Size: 1.76 KB

Versions: 9

Compression:

Stored size: 1.76 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../lib/puppettest'

require 'mocha'

class AptitudePackageProviderTest < PuppetTest::TestCase
    confine "Aptitude package provider missing" =>
        Puppet::Type.type(:package).provider(:aptitude).suitable?

	def setup
        super
		@type = Puppet::Type.type(:package)
	end
	
	def test_install
		pkg = @type.create :name => 'faff',
		                   :provider => :aptitude,
		                   :ensure => :present,
		                   :source => "/tmp/faff.deb"

 		pkg.provider.expects(
 		                 :dpkgquery
 					  ).with(
 							  '-W',
 							  '--showformat',
 							  '${Status} ${Package} ${Version}\n',
 							  'faff'
 					  ).returns(
 					        "deinstall ok config-files faff 1.2.3-1\n"
 					  ).times(1)

		pkg.provider.expects(
		                 :aptitude
		           ).with(
		                 '-y',
		                 '-o',
		                 'DPkg::Options::=--force-confold',
		                 :install,
		                 'faff'
					  ).returns(0)
		
		pkg.evaluate.each { |state| 
                    state.transaction = self 
                    state.forward 
          }
	end
	
	def test_purge
		pkg = @type.create :name => 'faff', :provider => :aptitude, :ensure => :purged

		pkg.provider.expects(
		                 :dpkgquery
					  ).with(
					        '-W',
					        '--showformat',
					        '${Status} ${Package} ${Version}\n',
					        'faff'
					  ).returns(
					        "install ok installed faff 1.2.3-1\n"
					  ).times(1)
		pkg.provider.expects(
		                 :aptitude
					  ).with(
					        '-y',
					        'purge',
					        'faff'
					  ).returns(0)
		
		pkg.evaluate.each { |state| state.transaction = self; state.forward }
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-0.23.0 test/ral/providers/package/aptitude.rb
puppet-0.23.2 test/ral/providers/package/aptitude.rb
puppet-0.23.1 test/ral/providers/package/aptitude.rb
puppet-0.24.0 test/ral/providers/package/aptitude.rb
puppet-0.24.2 test/ral/providers/package/aptitude.rb
puppet-0.24.3 test/ral/providers/package/aptitude.rb
puppet-0.24.1 test/ral/providers/package/aptitude.rb
puppet-0.24.4 test/ral/providers/package/aptitude.rb
puppet-0.24.5 test/ral/providers/package/aptitude.rb