Undo the param_names param_values changes

git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2207 980ebf18-57e1-0310-9a29-db15c13687c0
This commit is contained in:
shadoi 2007-02-17 01:57:50 +00:00
Родитель 8b18fdfe1a
Коммит 9a672ec630
2 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -968,11 +968,11 @@ class TestInterpreter < Test::Unit::TestCase
assert(res, "Did not get resource from rails")
param = res.params.find_by_name("owner")
param = res.param_names.find_by_name("owner", :include => :param_values)
assert(param, "Did not find owner param")
pvalue = param.value
pvalue = param.param_values.find_by_value("root")
assert_equal("root", pvalue[:value])
end
end

Просмотреть файл

@ -395,32 +395,34 @@ class TestResource < Test::Unit::TestCase
# Now make sure we can find it again
assert_nothing_raised do
obj = Puppet::Rails::Resource.find_by_restype_and_title(
res.type, res.title, :include => :params
res.type, res.title, :include => :param_names
)
end
assert_instance_of(Puppet::Rails::Resource, obj)
# Make sure we get the parameters back
params = options[:params] || [obj.params.collect { |p| p.name },
params = options[:params] || [obj.param_names.collect { |p| p.name },
res.to_hash.keys].flatten.collect { |n| n.to_s }.uniq
params.each do |name|
param = obj.params.find_by_name(name)
param = obj.param_names.find_by_name(name)
if res[name]
assert(param, "resource did not keep %s" % name)
else
assert(! param, "resource did not delete %s" % name)
end
if param
values = param.param_values.collect { |pv| pv.value }
should = res[param.name]
should = [should] unless should.is_a?(Array)
assert_equal(should, param.value,
assert_equal(should, values,
"%s was different" % param.name)
end
end
end
def test_to_rails
railsteardown
railsinit
res = mkresource :type => "file", :title => "/tmp/testing",
:source => @source, :scope => @scope,