def generate_external_user_with_resp(service_url, user=True, release=True):
 cas_resp = make_external_response(release=release)
 validated_credentials = cas.validate_external_credential(cas_resp.user)
 if user:
  user = UserFactory.build()
  user.external_identity = {validated_credentials['provider']: {validated_credentials['id']: 'VERIFIED'}}
  user.save()
  return (user, validated_credentials, cas_resp)
 else:
  user = {'external_id_provider': validated_credentials['provider'], 'external_id': validated_credentials['id'], 'fullname': validated_credentials['id'], 'access_token': cas_resp.attributes['accessToken'], 'service_url': service_url}
  return (user, validated_credentials, cas_resp)

def generate_external_user_with_resp ( service_url , user = True , release = True ) : cas_resp = make_external_response ( release = release ) validated_credentials = cas . validate_external_credential ( cas_resp . user ) if user : user = UserFactory . build ( ) user . external_identity = { validated_credentials [ 'provider' ] : { validated_credentials [ 'id' ] : 'VERIFIED' } } user . save ( ) return ( user , validated_credentials , cas_resp ) else : user = { 'external_id_provider' : validated_credentials [ 'provider' ] , 'external_id' : validated_credentials [ 'id' ] , 'fullname' : validated_credentials [ 'id' ] , 'access_token' : cas_resp . attributes [ 'accessToken' ] , 'service_url' : service_url } return ( user , validated_credentials , cas_resp )
generate mock user .