Example #1
0
def runDomainTest():
    """
    Return True if buildslave is a domain member.
    """
    # For now, elevated tests are executed only on the domain controller
    # buildslave.
    if '-dc-' in ChevahTestCase.getHostname():
        return True

    return False
Example #2
0
    def setUserPassword(self, user):
        """
        On Windows we can not change the password without having the
        old password.

        For not this works, but this code is not 100% valid.
        """
        # NetUserChangePassword works a little different that other
        # Net* functions. In order to work on local computer it requires
        # that the first argument be the computer name and not 'None'
        # like the rest of Net* functions.
        pdc = user.pdc
        if not pdc:
            pdc = ChevahTestCase.getHostname()

        try:
            import win32net
            win32net.NetUserChangePassword(
                pdc, user.name, user.password, user.password)
        except:
            print('Failed to set password "%s" for user "%s" on pdc "%s".' % (
                user.password, user.name, pdc))
            raise