diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-17 16:55:05 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-17 16:55:05 +0000 |
| commit | a8bdada4acadd2d5c0a08dd1c9d1a4fe5232e061 (patch) | |
| tree | f6c001114c55dba41064ba2d8f7b1f3d39677a62 /test | |
| parent | 6654c4cb44a0043314b2cb5cbefe3f6c1529aa23 (diff) | |
Users and groups now work on OS X. I had to make some key changes to how transactions and state changes work -- the most important is that it is no longer an error to try to sync a state that is already in sync. I could not find another way to handle all user states being out of sync but the first state actually syncs everything.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@686 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/types/tc_user.rb | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/test/types/tc_user.rb b/test/types/tc_user.rb index 057cd40e0..7c82587c7 100755 --- a/test/types/tc_user.rb +++ b/test/types/tc_user.rb @@ -109,6 +109,21 @@ class TestUser < TestPuppet } end + def mkuser(name) + user = nil + assert_nothing_raised { + user = Puppet::Type::User.create( + :name => name, + :comment => "Puppet Testing User", + :gid => Process.gid, + :shell => findshell(), + :home => "/home/%s" % name + ) + } + + return user + end + def attrtest_comment(user) old = user.is(:comment) user[:comment] = "A different comment" @@ -179,8 +194,6 @@ class TestUser < TestPuppet comp = newcomp("gidtest", user) user.retrieve - Puppet.notice "%s vs %s vs %s" % - [user.is(:gid), user.should(:gid), old.inspect] user[:gid] = old @@ -269,9 +282,10 @@ class TestUser < TestPuppet Puppet::Type::User.validstates.each { |name, state| assert_nothing_raised { - method = state.infomethod + method = state.posixmethod assert(method, "State %s has no infomethod" % name) - assert(obj.respond_to?(method), "State %s has an invalid method %s" % + assert(obj.respond_to?(method), + "State %s has an invalid method %s" % [name, method]) } } @@ -279,20 +293,33 @@ class TestUser < TestPuppet if Process.uid == 0 def test_simpleuser + name = "pptest" + + assert(missing?(name), "User %s is present" % name) + + user = mkuser(name) + + @@tmpusers << name + + comp = newcomp("usercomp", user) + + trans = assert_events(comp, [:user_created], "user") + + assert_equal("Puppet Testing User", current?(:comment, user[:name]), + "Comment was not set") + + assert_rollback_events(trans, [:user_deleted], "user") + + assert(missing?(user[:name])) + end + + def test_allstates user = nil name = "pptest" assert(missing?(name), "User %s is present" % name) - assert_nothing_raised { - user = Puppet::Type::User.create( - :name => name, - :comment => "Puppet Testing User", - :gid => Process.gid, - :shell => findshell(), - :home => "/home/%s" % name - ) - } + user = mkuser(name) @@tmpusers << name @@ -315,10 +342,6 @@ class TestUser < TestPuppet $stderr.puts "Not testing attr %s of user" % test end } - - assert_rollback_events(trans, [:user_deleted], "user") - - assert(missing?(user[:name])) end else $stderr.puts "Not root; skipping user creation/modification tests" |
