summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-01-28 14:52:04 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-01-28 14:54:19 -0800
commitbf44e72b19187dbb4bc696ba8e1b3bc872c32d46 (patch)
treef54de1c68dffa2f962b7fedb9f41c89a9717e7cd
parent1dc6b42d5dbaf0ca2ad1b1e9dd2a5788bcdb643d (diff)
downloadpuppet-bf44e72b19187dbb4bc696ba8e1b3bc872c32d46.tar.gz
puppet-bf44e72b19187dbb4bc696ba8e1b3bc872c32d46.tar.xz
puppet-bf44e72b19187dbb4bc696ba8e1b3bc872c32d46.zip
Bug #6061 -- verify that negative {min,max}_password_age are accepted.
Setting the age value to -1 will disable the specific aging value; we should accept that, but continue to reject null or empty values as invalid. Add tests to verify that this code enforces as expected.
-rwxr-xr-xspec/unit/type/user_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb
index 0c3e2ab2d..297134446 100755
--- a/spec/unit/type/user_spec.rb
+++ b/spec/unit/type/user_spec.rb
@@ -245,6 +245,34 @@ describe user do
end
end
+ describe "when managing minimum password age" do
+ before do
+ @age = user.attrclass(:password_min_age).new(:resource => @resource)
+ end
+
+ it "should accept a negative minimum age" do
+ expect { @age.should = -1 }.should_not raise_error
+ end
+
+ it "should fail with an empty minimum age" do
+ expect { @age.should = '' }.should raise_error(Puppet::Error)
+ end
+ end
+
+ describe "when managing maximum password age" do
+ before do
+ @age = user.attrclass(:password_max_age).new(:resource => @resource)
+ end
+
+ it "should accept a negative maximum age" do
+ expect { @age.should = -1 }.should_not raise_error
+ end
+
+ it "should fail with an empty maximum age" do
+ expect { @age.should = '' }.should raise_error(Puppet::Error)
+ end
+ end
+
describe "when managing passwords" do
before do
@password = user.attrclass(:password).new(:resource => @resource, :should => "mypass")