mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge pull request #54588 from garethgreenaway/2019_2_1_port_52786
[master] Porting #52786 to master
This commit is contained in:
commit
3c5a791b43
@ -161,13 +161,13 @@ def _changes(name,
|
|||||||
if fullname is not None and lusr['fullname'] != fullname:
|
if fullname is not None and lusr['fullname'] != fullname:
|
||||||
change['fullname'] = fullname
|
change['fullname'] = fullname
|
||||||
if win_homedrive and lusr['homedrive'] != win_homedrive:
|
if win_homedrive and lusr['homedrive'] != win_homedrive:
|
||||||
change['homedrive'] = win_homedrive
|
change['win_homedrive'] = win_homedrive
|
||||||
if win_profile and lusr['profile'] != win_profile:
|
if win_profile and lusr['profile'] != win_profile:
|
||||||
change['profile'] = win_profile
|
change['win_profile'] = win_profile
|
||||||
if win_logonscript and lusr['logonscript'] != win_logonscript:
|
if win_logonscript and lusr['logonscript'] != win_logonscript:
|
||||||
change['logonscript'] = win_logonscript
|
change['win_logonscript'] = win_logonscript
|
||||||
if win_description and lusr['description'] != win_description:
|
if win_description and lusr['description'] != win_description:
|
||||||
change['description'] = win_description
|
change['win_description'] = win_description
|
||||||
|
|
||||||
# MacOS doesn't have full GECOS support, so check for the "ch" functions
|
# MacOS doesn't have full GECOS support, so check for the "ch" functions
|
||||||
# and ignore these parameters if these functions do not exist.
|
# and ignore these parameters if these functions do not exist.
|
||||||
|
@ -269,3 +269,39 @@ class UserTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
self.assertSaltTrueReturn(
|
self.assertSaltTrueReturn(
|
||||||
self.run_state('user.absent', name=self.user_name)
|
self.run_state('user.absent', name=self.user_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@destructiveTest
|
||||||
|
@skip_if_not_root
|
||||||
|
@skipIf(not salt.utils.platform.is_windows(), 'Windows only tests')
|
||||||
|
class WinUserTest(ModuleCase, SaltReturnAssertsMixin):
|
||||||
|
'''
|
||||||
|
test for user absent
|
||||||
|
'''
|
||||||
|
def tearDown(self):
|
||||||
|
self.assertSaltTrueReturn(
|
||||||
|
self.run_state('user.absent', name=USER)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_user_present_existing(self):
|
||||||
|
ret = self.run_state('user.present',
|
||||||
|
name=USER,
|
||||||
|
win_homedrive='U:',
|
||||||
|
win_profile='C:\\User\\{0}'.format(USER),
|
||||||
|
win_logonscript='C:\\logon.vbs',
|
||||||
|
win_description='Test User Account')
|
||||||
|
self.assertSaltTrueReturn(ret)
|
||||||
|
ret = self.run_state('user.present',
|
||||||
|
name=USER,
|
||||||
|
win_homedrive='R:',
|
||||||
|
win_profile='C:\\Users\\{0}'.format(USER),
|
||||||
|
win_logonscript='C:\\Windows\\logon.vbs',
|
||||||
|
win_description='Temporary Account')
|
||||||
|
self.assertSaltTrueReturn(ret)
|
||||||
|
self.assertSaltStateChangesEqual(ret, 'R:', keys=['homedrive'])
|
||||||
|
self.assertSaltStateChangesEqual(
|
||||||
|
ret, 'C:\\Users\\{0}'.format(USER), keys=['profile'])
|
||||||
|
self.assertSaltStateChangesEqual(
|
||||||
|
ret, 'C:\\Windows\\logon.vbs', keys=['logonscript'])
|
||||||
|
self.assertSaltStateChangesEqual(
|
||||||
|
ret, 'Temporary Account', keys=['description'])
|
||||||
|
Loading…
Reference in New Issue
Block a user