Sha256: ff52b629d489613e5b94998bb7e4ec5917a66c2352e9949cc4d681fa52f9c2c9

Contents?: true

Size: 1.53 KB

Versions: 35

Compression:

Stored size: 1.53 KB

Contents

#!/usr/bin/env ruby

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

require 'mocha'

class AptitudePackageProviderTest < PuppetTest::TestCase
  include PuppetTest

  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.new :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)

    assert_apply( pkg )
  end

  def test_purge
    pkg = @type.new :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)

    assert_apply( pkg )
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 test/ral/providers/package/aptitude.rb
puppet-2.7.25 test/ral/providers/package/aptitude.rb
puppet-2.7.24 test/ral/providers/package/aptitude.rb
puppet-2.7.23 test/ral/providers/package/aptitude.rb
puppet-2.7.22 test/ral/providers/package/aptitude.rb
puppet-2.7.21 test/ral/providers/package/aptitude.rb
puppet-2.7.20 test/ral/providers/package/aptitude.rb
puppet-2.7.20.rc1 test/ral/providers/package/aptitude.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/test/ral/providers/package/aptitude.rb
puppet-2.7.19 test/ral/providers/package/aptitude.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/test/ral/providers/package/aptitude.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/test/ral/providers/package/aptitude.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/test/ral/providers/package/aptitude.rb
puppet-2.7.18 test/ral/providers/package/aptitude.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/test/ral/providers/package/aptitude.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/test/ral/providers/package/aptitude.rb
puppet-2.7.17 test/ral/providers/package/aptitude.rb
puppet-2.7.16 test/ral/providers/package/aptitude.rb
puppet-2.7.14 test/ral/providers/package/aptitude.rb
puppet-2.7.13 test/ral/providers/package/aptitude.rb