summaryrefslogtreecommitdiffstats
path: root/test/ral
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-04-25 20:59:00 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-04-25 20:59:00 +0000
commit0aeda974813104c0f0e940f75c4d19888515f7fc (patch)
tree92acbb9a3fcc97ca8b65db23ec7914ce47374cd3 /test/ral
parent7fbd3ffe886e821a4e85e2fe9a27529133f1b84b (diff)
downloadpuppet-0aeda974813104c0f0e940f75c4d19888515f7fc.tar.gz
puppet-0aeda974813104c0f0e940f75c4d19888515f7fc.tar.xz
puppet-0aeda974813104c0f0e940f75c4d19888515f7fc.zip
Adding the ability to manage passwords with the useradd provider
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2414 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/ral')
-rwxr-xr-xtest/ral/manager/attributes.rb4
-rwxr-xr-xtest/ral/providers/user/useradd.rb21
-rwxr-xr-xtest/ral/types/cron.rb3
3 files changed, 25 insertions, 3 deletions
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index a23a5e9ce..43f716ec2 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -283,7 +283,9 @@ class TestTypeAttributes < Test::Unit::TestCase
yes.each { |a| assert(resource.should(a), "Did not get value for %s in %s" % [a, prov.name]) }
no.each do |a|
assert_nil(resource.should(a), "Got value for unsupported %s in %s" % [a, prov.name])
- assert(@logs.find { |l| l.message =~ /not managing attribute #{a}/ and l.level == :info }, "No warning about failed %s" % a)
+ if Puppet::Util::Log.sendlevel?(:info)
+ assert(@logs.find { |l| l.message =~ /not managing attribute #{a}/ and l.level == :info }, "No warning about failed %s" % a)
+ end
end
@logs.clear
diff --git a/test/ral/providers/user/useradd.rb b/test/ral/providers/user/useradd.rb
index e3f2183ac..97935f4a9 100755
--- a/test/ral/providers/user/useradd.rb
+++ b/test/ral/providers/user/useradd.rb
@@ -177,7 +177,7 @@ class UserAddProviderTest < PuppetTest::TestCase
@user.provider.create
end
- def disabled_test_manages_password
+ def test_manages_password
if Facter.value(:kernel) != "Linux"
assert(! @provider.feature?(:manages_passwords),
"Defaulted to managing passwords on %s" %
@@ -239,6 +239,25 @@ class UserAddProviderTest < PuppetTest::TestCase
@user.provider.password = @vals[:password]
end
+
end
+class UserRootAddProviderTest < PuppetTest::TestCase
+ confine "useradd user provider missing" => Puppet::Type.type(:user).provider(:useradd).suitable?
+ confine "not running as root" => (Process.uid == 0)
+
+ def test_password
+ user = Puppet::Type.type(:user).create(:name => "root", :check => [:password], :provider => :useradd)
+
+ provider = user.provider
+
+ assert_nothing_raised("Could not check password") do
+ pass = provider.password
+ assert(pass, "Did not get password for root")
+ assert(pass!= "x", "Password was retrieved from /etc/passwd instead of /etc/shadow")
+ end
+ end
+end
+
+
# $Id$
diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb
index 941f8d072..2b09fd66d 100755
--- a/test/ral/types/cron.rb
+++ b/test/ral/types/cron.rb
@@ -301,7 +301,8 @@ class TestCron < Test::Unit::TestCase
end
end
- def test_names
+ # Disabled, since we no longer have naming requirements.
+ def disabled_test_names
cron = mkcron("nametest")
["bad name", "bad.name"].each do |name|