spec/unit/provider/user/windows_adsi_spec.rb in puppet-2.7.19 vs spec/unit/provider/user/windows_adsi_spec.rb in puppet-2.7.20.rc1
- old
+ new
@@ -81,10 +81,21 @@
user.expects(:[]=).with('HomeDirectory', 'C:\Users\testuser')
provider.create
end
+ it "should load the profile if managehome is set", :if => Puppet.features.microsoft_windows? do
+ resource[:password] = '0xDeadBeef'
+ resource[:managehome] = true
+
+ user = stub_everything 'user'
+ Puppet::Util::ADSI::User.expects(:create).with('testuser').returns user
+ Puppet::Util::Windows::User.expects(:load_profile).with('testuser', '0xDeadBeef')
+
+ provider.create
+ end
+
it "should set a user's password" do
provider.user.expects(:password=).with('plaintextbad')
provider.password = "plaintextbad"
end
@@ -123,17 +134,28 @@
connection.expects(:Delete).with('user', 'testuser')
provider.delete
end
+ it 'should delete the profile if managehome is set', :if => Puppet.features.microsoft_windows? do
+ resource[:managehome] = true
+
+ sid = 'S-A-B-C'
+ Puppet::Util::Windows::Security.expects(:name_to_sid).with('testuser').returns(sid)
+ Puppet::Util::ADSI::UserProfile.expects(:delete).with(sid)
+ connection.expects(:Delete).with('user', 'testuser')
+
+ provider.delete
+ end
+
it "should commit the user when flushed" do
provider.user.expects(:commit)
provider.flush
end
- it "should return the user's SID as uid" do
- Puppet::Util::ADSI.expects(:sid_for_account).with('testuser').returns('S-1-5-21-1362942247-2130103807-3279964888-1111')
+ it "should return the user's SID as uid", :if => Puppet.features.microsoft_windows? do
+ Puppet::Util::Windows::Security.expects(:name_to_sid).with('testuser').returns('S-1-5-21-1362942247-2130103807-3279964888-1111')
provider.uid.should == 'S-1-5-21-1362942247-2130103807-3279964888-1111'
end
it "should fail when trying to manage the uid property" do