[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
Luke Kanies
luke at madstop.com
Fri Jan 23 14:21:24 UTC 2009
The following commit has been merged in the master branch:
commit 0fff7d76e89a650f5d2e78b2c69b30635880c36b
Author: Luke Kanies <luke at madstop.com>
Date: Wed Oct 8 23:44:41 2008 -0500
Fixing some tests that were broken in 2fba85af
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index 18b0866..6479b4a 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -30,14 +30,18 @@ class TestGroupProvider < Test::Unit::TestCase
end
def mkgroup(name, hash = {})
- fakeresource = fakeresource(:group, name)
+ fakeresource = stub 'group', :allowdupe? => false, :name => name
+ fakeresource.stubs(:[]).returns nil
+ fakeresource.stubs(:should).returns nil
+ fakeresource.stubs(:[]).with(:name).returns name
+ hash.each do |name, val|
+ fakeresource.stubs(:should).with(name).returns val
+ fakeresource.stubs(:[]).with(name).returns val
+ end
group = nil
assert_nothing_raised {
group = @provider.new(fakeresource)
}
- hash.each do |name, val|
- fakeresource[name] = val
- end
assert(group, "Could not create provider group")
return group
@@ -108,19 +112,19 @@ class TestGroupProvider < Test::Unit::TestCase
def attrtest_ensure(group)
old = group.ensure
assert_nothing_raised {
- group.ensure = :absent
+ group.delete
}
assert(!group.exists?, "Group was not deleted")
assert_nothing_raised {
- group.ensure = :present
+ group.create
}
assert(group.exists?, "Group was not created")
unless old == :present
assert_nothing_raised {
- group.ensure = old
+ group.delete
}
end
end
@@ -211,7 +215,6 @@ class TestGroupProvider < Test::Unit::TestCase
unless Facter["operatingsystem"].value == "FreeBSD"
def test_duplicateIDs
group1 = mkgroup("group1", :gid => 125)
- group2 = mkgroup("group2", :gid => 125)
@@tmpgroups << "group1"
@@tmpgroups << "group2"
@@ -222,16 +225,14 @@ class TestGroupProvider < Test::Unit::TestCase
# Not all OSes fail here, so we can't test that it doesn't work with
# it off, only that it does work with it on.
- assert_nothing_raised {
- group2.resource[:allowdupe] = :true
- }
+ group2 = mkgroup("group2", :gid => 125)
+ group2.resource.stubs(:allowdupe?).returns true
# Now create the second group
assert_nothing_raised {
group2.create
}
- assert_equal(:present, group2.ensure,
- "Group did not get created")
+ assert_equal(:present, group2.ensure, "Group did not get created")
end
end
else
diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb
index 0651d6c..4df8958 100755
--- a/test/ral/providers/user.rb
+++ b/test/ral/providers/user.rb
@@ -214,20 +214,20 @@ class TestUserProvider < Test::Unit::TestCase
def attrtest_ensure(user)
old = user.ensure
assert_nothing_raised {
- user.ensure = :absent
+ user.delete
}
assert(missing?(user.name), "User is still present")
assert_nothing_raised {
- user.ensure = :present
+ user.create
}
assert(!missing?(user.name), "User is absent")
assert_nothing_raised {
- user.ensure = :absent
+ user.delete
}
unless old == :absent
- user.ensure = old
+ user.create
end
end
@@ -398,10 +398,10 @@ class TestUserProvider < Test::Unit::TestCase
# Some tests to verify that groups work correctly startig from nothing
# Remove our user
- user.ensure = :absent
+ user.delete
# And add it again
- user.ensure = :present
+ user.create
# Make sure that the group list is added at creation time.
# This is necessary because we don't have default fakedata for groups.
@@ -498,8 +498,8 @@ class TestUserProvider < Test::Unit::TestCase
user2.resource[:uid] = 125
cleanup do
- user1.ensure = :absent
- user2.ensure = :absent
+ user1.delete
+ user2.delete
end
# Not all OSes fail here, so we can't test that it doesn't work with
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list