From 6be8b211465ee617e58b96e1622bbf6b6068beb2 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 15 Jun 2007 19:49:26 +0000 Subject: Modifying the check metaparam so that it just silently ignores metaparams and parameters, since they're uncheckable, and only tries to check properties git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2591 980ebf18-57e1-0310-9a29-db15c13687c0 --- test/ral/manager/attributes.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb index 5a5064129..273dc6844 100755 --- a/test/ral/manager/attributes.rb +++ b/test/ral/manager/attributes.rb @@ -285,6 +285,36 @@ class TestTypeAttributes < Test::Unit::TestCase @logs.clear end end + + # Make sure the 'check' metaparam just ignores non-properties, rather than failing. + def test_check_allows_parameters + file = Puppet::Type.type(:file) + klass = file.attrclass(:check) + + resource = file.create(:path => tempfile) + inst = klass.new(:resource => resource) + + {:property => [:owner, :group], :parameter => [:ignore, :recurse], :metaparam => [:require, :subscribe]}.each do |attrtype, attrs| + assert_nothing_raised("Could not set check to a single %s value" % attrtype) do + inst.value = attrs[0] + end + + if attrtype == :property + assert(resource.property(attrs[0]), "Check did not create property instance during single check") + end + assert_nothing_raised("Could not set check to multiple %s values" % attrtype) do + inst.value = attrs + end + if attrtype == :property + assert(resource.property(attrs[1]), "Check did not create property instance during multiple check") + end + end + + # But make sure actually invalid attributes fail + assert_raise(Puppet::Error, ":check did not fail on invalid attribute") do + inst.value = :nosuchattr + end + end end # $Id$ -- cgit