blob: 8f7e74d4db71a02527da8341b2bf805b5968290d (
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
51
52
53
54
|
#!/usr/bin/env ruby
#
# Created by Luke A. Kanies on 2006-11-29.
# Copyright (c) 2006. All rights reserved.
require 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
|