blob: e42c6c293af8632219becf9712ec1161086faf68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/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
|