summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/user
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-06-16 22:42:12 -0500
committerLuke Kanies <luke@madstop.com>2008-06-16 22:42:12 -0500
commit24ca81fcdca9fa321a706453c96536e9bbeab7e2 (patch)
treed41bd575b7f41ad0bf40ba02dff323ae6aac2f6c /spec/unit/provider/user
parent7b569fb6e191a8d04b5ec5431b690d6d735c8582 (diff)
downloadpuppet-24ca81fcdca9fa321a706453c96536e9bbeab7e2.tar.gz
puppet-24ca81fcdca9fa321a706453c96536e9bbeab7e2.tar.xz
puppet-24ca81fcdca9fa321a706453c96536e9bbeab7e2.zip
Fixed #1360 -- allowdupe works with groups again.
I've added a couple of tests for this bit of the user and group useradd/groupadd providers, but I haven't migrated the rest of the tests.
Diffstat (limited to 'spec/unit/provider/user')
-rwxr-xr-xspec/unit/provider/user/useradd.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/provider/user/useradd.rb b/spec/unit/provider/user/useradd.rb
new file mode 100755
index 000000000..96a785589
--- /dev/null
+++ b/spec/unit/provider/user/useradd.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+provider_class = Puppet::Type.type(:user).provider(:useradd)
+
+describe provider_class do
+ before do
+ @resource = stub("resource", :name => "myuser", :managehome? => nil)
+ @provider = provider_class.new(@resource)
+ end
+
+ # #1360
+ it "should add -o when allowdupe is enabled and the user is being created" do
+ @resource.stubs(:should).returns "fakeval"
+ @resource.stubs(:[]).returns "fakeval"
+ @resource.expects(:allowdupe?).returns true
+ @provider.expects(:execute).with { |args| args.include?("-o") }
+
+ @provider.create
+ end
+
+ it "should add -o when allowdupe is enabled and the uid is being modified" do
+ @resource.stubs(:should).returns "fakeval"
+ @resource.stubs(:[]).returns "fakeval"
+ @resource.expects(:allowdupe?).returns true
+ @provider.expects(:execute).with { |args| args.include?("-o") }
+
+ @provider.uid = 150
+ end
+end