summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-07 21:29:16 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-07 21:29:16 +0000
commit221343060856fa27ace550b1a76e6da59c2df536 (patch)
tree9863af95b54d3f2a5859283d0c83d45f1fed478c /test
parent923226e7ac5d931dc6b01f5ae1cee3beb24b2fee (diff)
downloadpuppet-221343060856fa27ace550b1a76e6da59c2df536.tar.gz
puppet-221343060856fa27ace550b1a76e6da59c2df536.tar.xz
puppet-221343060856fa27ace550b1a76e6da59c2df536.zip
making states capable of being the namevar
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@636 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/types/tc_type.rb40
1 files changed, 26 insertions, 14 deletions
diff --git a/test/types/tc_type.rb b/test/types/tc_type.rb
index 3522539d5..1cc7669e0 100644
--- a/test/types/tc_type.rb
+++ b/test/types/tc_type.rb
@@ -7,9 +7,10 @@ end
# $Id$
require 'puppet/type'
+require 'puppettest'
require 'test/unit'
-class TestType < Test::Unit::TestCase
+class TestType < TestPuppet
def test_typemethods
assert_nothing_raised() {
Puppet::Type.buildstatehash
@@ -17,33 +18,32 @@ class TestType < Test::Unit::TestCase
Puppet::Type.eachtype { |type|
name = nil
- assert_nothing_raised() {
- name = type.name
+ assert_nothing_raised("Searching for name for %s caused failure" %
+ type.to_s) {
+ name = type.name
}
- assert(
- name
- )
+ assert(name, "Could not find name for %s" % type.to_s)
assert_equal(
type,
- Puppet::Type.type(name)
+ Puppet::Type.type(name),
+ "Failed to retrieve %s by name" % name
)
assert(
- type.namevar
+ type.namevar,
+ "Failed to retrieve namevar for %s" % name
)
assert_not_nil(
- type.states
+ type.states,
+ "States for %s are nil" % name
)
assert_not_nil(
- type.validstates
- )
-
- assert(
- type.validparameter?(type.namevar)
+ type.validstates,
+ "Valid states for %s are nil" % name
)
}
end
@@ -95,4 +95,16 @@ class TestType < Test::Unit::TestCase
file.sync
}
end
+
+ def test_nameasstate
+ # currently groups are the only objects with the namevar as a state
+ group = nil
+ assert_nothing_raised {
+ group = Puppet::Type::Group.new(
+ :name => "testing"
+ )
+ }
+
+ assert_equal("testing", group.name, "Could not retrieve name")
+ end
end