summaryrefslogtreecommitdiffstats
path: root/test/network/handler
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-01 00:45:45 -0500
committerLuke Kanies <luke@madstop.com>2008-04-01 00:45:45 -0500
commitb49fb68f768e8b98c555ef0ae08a7bd22f5d36bd (patch)
treea3d7964621a58b241d417f1f399629e23c8f9f10 /test/network/handler
parent5e78151d1736e2c4cb741c2cbb7c6b5a59ed3e13 (diff)
downloadpuppet-b49fb68f768e8b98c555ef0ae08a7bd22f5d36bd.tar.gz
puppet-b49fb68f768e8b98c555ef0ae08a7bd22f5d36bd.tar.xz
puppet-b49fb68f768e8b98c555ef0ae08a7bd22f5d36bd.zip
Fixing the tests in test/ that were broken as
a result of the move to no global resources.
Diffstat (limited to 'test/network/handler')
-rwxr-xr-xtest/network/handler/resource.rb85
1 files changed, 26 insertions, 59 deletions
diff --git a/test/network/handler/resource.rb b/test/network/handler/resource.rb
index 5102291e1..269c9571c 100755
--- a/test/network/handler/resource.rb
+++ b/test/network/handler/resource.rb
@@ -40,68 +40,38 @@ class TestResourceServer < Test::Unit::TestCase
server = Puppet::Network::Handler.resource.new()
end
- # The first run we create the file on the copy, the second run
- # the file is already there so the object should be in sync
- 2.times do |i|
- [ [nil],
- [[:content, :mode], []],
- [[], [:content]],
- [[:content], [:mode]]
- ].each do |ary|
- retrieve = ary[0] || []
- ignore = ary[1] || []
-
- File.open(file, "w") { |f| f.print str }
-
- result = nil
- assert_nothing_raised do
- result = server.describe("file", file, *ary)
- end
-
- assert(result, "Could not retrieve file information")
-
- assert_instance_of(Puppet::TransObject, result)
+ [ [nil],
+ [[:content, :mode], []],
+ [[], [:content]],
+ [[:content], [:mode]]
+ ].each do |ary|
+ retrieve = ary[0] || []
+ ignore = ary[1] || []
- # And remove the file, so we can verify it gets recreated
- if i == 0
- File.unlink(file)
- end
+ File.open(file, "w") { |f| f.print str }
- object = nil
- assert_nothing_raised do
- object = result.to_type
- end
+ result = nil
+ assert_nothing_raised do
+ result = server.describe("file", file, *ary)
+ end
- assert(object, "Could not create type")
+ assert(result, "Could not retrieve file information")
- retrieve.each do |property|
- assert(object.should(property), "Did not retrieve %s" % property)
- end
+ assert_instance_of(Puppet::TransObject, result)
- ignore.each do |property|
- assert(! object.should(property), "Incorrectly retrieved %s" % property)
- end
+ object = nil
+ assert_nothing_raised do
+ object = result.to_type
+ end
- if i == 0
- assert_events([:file_created], object)
- else
- assert_nothing_raised {
- assert(object.insync?(object.retrieve), "Object was not in sync")
- }
- end
+ assert(object, "Could not create type")
- assert(FileTest.exists?(file), "File did not get recreated")
+ retrieve.each do |property|
+ assert(object.should(property), "Did not retrieve %s" % property)
+ end
- if i == 0
- if object.should(:content)
- assert_equal(str, File.read(file), "File contents are not the same")
- else
- assert_equal("", File.read(file), "File content was incorrectly made")
- end
- end
- if FileTest.exists? file
- File.unlink(file)
- end
+ ignore.each do |property|
+ assert(! object.should(property), "Incorrectly retrieved %s" % property)
end
end
end
@@ -143,6 +113,8 @@ class TestResourceServer < Test::Unit::TestCase
object = result.to_type
end
+ catalog = mk_catalog(object)
+
assert(object, "Could not create type")
retrieve.each do |property|
@@ -152,11 +124,6 @@ class TestResourceServer < Test::Unit::TestCase
ignore.each do |property|
assert(! object.should(property), "Incorrectly retrieved %s" % property)
end
-
- #assert_apply(object)
- assert_events([:directory_created], object)
- assert(FileTest.directory?(file), "Directory did not get recreated")
- Dir.rmdir(file)
end
end