Sha256: 7558f9ef87787c896a856f250afb592edc30d8f94cc77acd74d7e86d3e3d9f08

Contents?: true

Size: 1.56 KB

Versions: 9

Compression:

Stored size: 1.56 KB

Contents

#!/usr/bin/env ruby

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

require 'mocha'

class DpkgPackageProviderTest < PuppetTest::TestCase
    confine "dpkg package provider missing" =>
        Puppet::Type.type(:package).provider(:dpkg).suitable?
	def setup
        super
		@type = Puppet::Type.type(:package)
	end
	
	def test_install
		pkg = @type.create :name => 'faff',
		                   :provider => :dpkg,
		                   :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(
		                 :dpkg
		           ).with(
		                 '-i',
		                 '/tmp/faff.deb'
					  ).returns(0)
		
		pkg.evaluate.each { |state| state.transaction = self; state.forward }
	end
	
	def test_purge
		pkg = @type.create :name => 'faff', :provider => :dpkg, :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(
		                 :dpkg
					  ).with(
					        '--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/dpkg.rb
puppet-0.23.1 test/ral/providers/package/dpkg.rb
puppet-0.23.2 test/ral/providers/package/dpkg.rb
puppet-0.24.0 test/ral/providers/package/dpkg.rb
puppet-0.24.3 test/ral/providers/package/dpkg.rb
puppet-0.24.4 test/ral/providers/package/dpkg.rb
puppet-0.24.1 test/ral/providers/package/dpkg.rb
puppet-0.24.2 test/ral/providers/package/dpkg.rb
puppet-0.24.5 test/ral/providers/package/dpkg.rb