예제 #1
0
def test_poll_user_auth_push_invalid_data(session_override):
    response_xml = utils_poll_user_auth_push_unknown_request_id()
    # custom_response = response_xml.replace('<transactionId>23456</transactionId><status>7005</status>', '')
    custom_response = response_xml.replace('7005', '')
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=custom_response)
    assert utils.poll_user_auth_push('0bd24cf0c94caefa') is False
예제 #2
0
def test_poll_user_auth_push_request_in_progress(session_override):
    response_xml = utils_poll_user_auth_push_in_progress_xml()
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=response_xml)
    utils.VIP_POLL_SLEEP_SECONDS = 1
    utils.VIP_POLL_SLEEP_MAX_COUNT = 1
    assert utils.poll_user_auth_push('2ae68a940ec4236b') is False
예제 #3
0
def test_poll_user_auth_push_unknown_transaction_id(session_override):
    """Return False if the Transaction ID is unknown.

  The following three classes of transaction fall in to this test:
    * Transaction IDs that are expired
    * Transaction IDs that are already used
    * Transaction IDs that are schema valid but made up lies

  Why? Because the API doesn't differentiate between them.
  """
    response_xml = utils_poll_user_auth_push_unknown_request_id()
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=response_xml)
    # Everything over 4 characters is valid for the API, its just a question of being known
    assert utils.poll_user_auth_push('12345678') is False
예제 #4
0
    def poll_push(self, *args):
        """Poll Symantec VIP service for a response to the push request."""
        if args:
            logger.debug(
                'Unexpected arguments: {0}, skipping validation against this credential'
                .format(args))
            return False
        # Do we have a transaction ID to query?
        if not self.latest_transaction_id:
            return False

        # Sleep before running the query, user needs time to respond
        logger.debug('Sleeping for %s seconds' % self.POLL_SLEEP_SECONDS)
        time.sleep(self.POLL_SLEEP_SECONDS)

        logger.debug('Running poll_user_auth_push with transaction ID %s' %
                     self.latest_transaction_id)
        # This returns True or False depending on the result
        poll_result = utils.poll_user_auth_push(self.latest_transaction_id)
        return poll_result
예제 #5
0
def test_poll_user_auth_push_invalid_xml(session_override):
    response_xml = '<xml>that is invalid</xml>'
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=response_xml)
    assert utils.poll_user_auth_push('0bd24cf0c94caefa') is False
예제 #6
0
def test_poll_user_auth_push_request_denied(session_override):
    response_xml = utils_poll_user_auth_push_user_denied_xml()
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=response_xml)
    assert utils.poll_user_auth_push('0bd24cf0c94caefa') is False
예제 #7
0
def test_poll_user_auth_push_request_approved(session_override):
    response_xml = utils_poll_user_auth_push_user_approved_xml()
    session_override.post(
        'https://userservices-auth.vip.symantec.com/vipuserservices/QueryService_1_8',
        text=response_xml)
    assert utils.poll_user_auth_push('2ae68a940ec4236b') is True
예제 #8
0
def test_poll_user_auth_push_without_transaction_id():
    """False if no transaction id passed in"""
    assert utils.poll_user_auth_push('') is False