Beispiel #1
0
def test_auth(logger, username, password, nnd=False):
    """
    synopsys:
        test_auth(username, password)

    service version:
        1

    result:
        In case of success:
            test version, "auth", username

        In case of error:
            AuthError
    """
    version = 1
    if nnd:
        client = getclient(logger)
        try:
            #raises if incorrect
            try:
                client.auth2(username, password)
            except Exception, err:
                raise AuthError(username)
        finally:
            client.quit()
    elif not authenticate(username, password, service="nuauth"):
        raise AuthError(username)

    return version, "auth", username
    def test_we_can_auth_our_test_user_with_pam(self):
        """
            Check that we can authenticate our test user with atlee-pam
        """
        error = "We can't authenticate the user %s with the password %s"
        tries = 5
        while tries >  0:
            result = authenticate(self.user_we_can_test,
                                        self.users_password,
                                        service="nuauth")
            if result:
                break
            tries = tries - 1
            sleep(2)

        assert result, error % (self.user_we_can_test, self.users_password)