Sha256: 245b6052180fb64d6ee39ca1f6c631f9aa9221c0164cb2a95a428b9f9c6cf75b

Contents?: true

Size: 1.1 KB

Versions: 33

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')

require 'puppettest'

class TestTypeManager < Test::Unit::TestCase
  include PuppetTest

  class FakeManager
    extend Puppet::MetaType::Manager
    def self.clear
      @types = {}
    end
  end

  def teardown
    super
    FakeManager.clear
  end

  # Make sure we can remove defined types
  def test_rmtype
    assert_nothing_raised {
      FakeManager.newtype :testing do
        newparam(:name, :namevar => true)
      end
    }
    assert(FakeManager.type(:testing), "Did not get fake type")

    assert_nothing_raised do
      FakeManager.rmtype(:testing)
    end

    assert_nil(FakeManager.type(:testing), "Type was not removed")
    assert(! defined?(FakeManager::Testing), "Constant was not removed")
  end

  def test_newtype
    assert_nothing_raised do
      FakeManager.newtype(:testing, :self_refresh => true) do
        newparam(:name, :namevar => true)
      end
    end

    test = FakeManager.type(:testing)
    assert(test, "did not get type")
    assert(test.self_refresh, "did not set attribute")
  end
end

Version data entries

33 entries across 33 versions & 3 rubygems

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