def test_set_password(self): ''' Test if it set the password for a named user. ''' mock_cmd = MagicMock(return_value={'retcode': False}) with patch.dict(win_shadow.__salt__, {'cmd.run_all': mock_cmd}): self.assertTrue(win_shadow.set_password('root', 'mysecretpassword'))
def test_set_password(self): ''' Test if it set the password for a named user. ''' mock_cmd = MagicMock(return_value={'retcode': False}) with patch.dict(win_shadow.__salt__, {'cmd.run_all': mock_cmd}): self.assertTrue(win_shadow.set_password('root', 'mysecretpassword'))
def test_set_password(self): ''' Test if it set the password for a named user. ''' mock_cmd = MagicMock(return_value={'retcode': False}) mock_user_info = MagicMock(return_value={'name': 'SALT', 'password_changed': '', 'expiration_date': ''}) with patch.dict(win_shadow.__salt__, {'cmd.run_all': mock_cmd, 'user.info': mock_user_info}): self.assertTrue(win_shadow.set_password('root', 'mysecretpassword'))
def test_set_password(self): """ Test if it set the password for a named user. """ mock_cmd = MagicMock(return_value={"retcode": False}) mock_user_info = MagicMock(return_value={ "name": "SALT", "password_changed": "", "expiration_date": "" }) with patch.dict(win_shadow.__salt__, { "cmd.run_all": mock_cmd, "user.info": mock_user_info }): self.assertTrue(win_shadow.set_password("root", "mysecretpassword"))