def test_send_user_auth_push_successful(session_override): response_xml = utils_send_user_auth_push_request_sent_xml() session_override.post( 'https://userservices-auth.vip.symantec.com/vipuserservices/AuthenticationService_1_8', text=response_xml) assert len(utils.send_user_auth_push('*****@*****.**')) > 4 assert utils.send_user_auth_push('*****@*****.**') is not None
def generate_challenge(self): """Send request for a push to Symantec VIP servers. Request Symantec send a push authentication request to the specified users device and save the transaction id to the database This method runs self.save() to record the transaction id. """ logger.debug( 'Calling send_user_auth_push and recording its transaction ID') auth_attempt = utils.send_user_auth_push(self.user.email) if auth_attempt is not None: logger.debug('Transaction ID: %s' % auth_attempt) self.latest_transaction_id = auth_attempt self.save(update_fields=['latest_transaction_id']) # Perform verification during challenge. Other option is overriding parts # of the submission form and this is, well, not better but acceptable verification_result = self.poll_push() return str('Sent (Check your device).') else: return str('An error occurred trying to send the push')
def test_send_user_auth_push_unknown_user(session_override): response_xml = utils_send_user_auth_push_invalid_user_xml() session_override.post( 'https://userservices-auth.vip.symantec.com/vipuserservices/AuthenticationService_1_8', text=response_xml) assert utils.send_user_auth_push('invalid user') is None
def test_send_user_auth_push_user_has_no_credentials(session_override): response_xml = utils_send_user_auth_push_user_has_no_credentials() session_override.post( 'https://userservices-auth.vip.symantec.com/vipuserservices/AuthenticationService_1_8', text=response_xml) assert utils.send_user_auth_push('*****@*****.**') is None
def test_send_user_auth_push_missing_user(): assert utils.send_user_auth_push('') is None