summaryrefslogtreecommitdiffstats
path: root/test/util/utiltest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/util/utiltest.rb')
-rwxr-xr-xtest/util/utiltest.rb99
1 files changed, 0 insertions, 99 deletions
diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb
index 1ab2ebb9c..ffb2ef347 100755
--- a/test/util/utiltest.rb
+++ b/test/util/utiltest.rb
@@ -40,105 +40,6 @@ class TestPuppetUtil < Test::Unit::TestCase
threads.each { |th| th.join }
end
- # First verify we can convert a known user
- def test_gidbyname
- %x{groups}.split(" ").each { |group|
- gid = nil
- assert_nothing_raised {
- gid = Puppet::Util.gid(group)
- }
-
- assert(gid, "Could not retrieve gid for %s" % group)
-
- assert(Puppet.type(:group)[group], "Util did not create %s" % group)
- }
- end
-
- # Then verify we can retrieve a known group by gid
- def test_gidbyid
- %x{groups}.split(" ").each { |group|
- obj = Puppet.type(:group).create(
- :name => group,
- :check => [:gid]
- )
- obj.retrieve
- id = obj.is(:gid)
- gid = nil
- assert_nothing_raised {
- gid = Puppet::Util.gid(id)
- }
-
- assert(gid, "Could not retrieve gid for %s" % group)
- assert_equal(id, gid, "Got mismatched ids")
- }
- end
-
- # Finally, verify that we can find groups by id even if we don't
- # know them
- def test_gidbyunknownid
- gid = nil
- group = Puppet::SUIDManager.gid
- assert_nothing_raised {
- gid = Puppet::Util.gid(group)
- }
-
- assert(gid, "Could not retrieve gid for %s" % group)
- assert_equal(group, gid, "Got mismatched ids")
- end
-
- def user
- require 'etc'
- unless defined? @user
- obj = Etc.getpwuid(Puppet::SUIDManager.uid)
- @user = obj.name
- end
- return @user
- end
-
- # And do it all over again for users
- # First verify we can convert a known user
- def test_uidbyname
- user = user()
- uid = nil
- assert_nothing_raised {
- uid = Puppet::Util.uid(user)
- }
-
- assert(uid, "Could not retrieve uid for %s" % user)
- assert_equal(Puppet::SUIDManager.uid, uid, "UIDs did not match")
- assert(Puppet.type(:user)[user], "Util did not create %s" % user)
- end
-
- # Then verify we can retrieve a known user by uid
- def test_uidbyid
- user = user()
- obj = Puppet.type(:user).create(
- :name => user,
- :check => [:uid]
- )
- obj.retrieve
- id = obj.is(:uid)
- uid = nil
- assert_nothing_raised {
- uid = Puppet::Util.uid(id)
- }
-
- assert(uid, "Could not retrieve uid for %s" % user)
- assert_equal(id, uid, "Got mismatched ids")
- end
-
- # Finally, verify that we can find users by id even if we don't
- # know them
- def test_uidbyunknownid
- uid = nil
- user = Puppet::SUIDManager.uid
- assert_nothing_raised {
- uid = Puppet::Util.uid(user)
- }
-
- assert(uid, "Could not retrieve uid for %s" % user)
- assert_equal(user, uid, "Got mismatched ids")
- end
def test_withumask
oldmask = File.umask