def test_extended_trial(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_extended_trial_plan'], 'no') self._change_to_extended_trial(self.community.name) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_extended_trial_plan'], 'yes')
def test_extended_trial(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_extended_trial_plan'], 'no') self._change_to_extended_trial(self.community.name) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_extended_trial_plan'], 'yes')
def test_probono_properties(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_pro_bono_plan'], 'no') self._change_to_probono(self.community.name, ProBonoStatus.YES) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_pro_bono_plan'], 'yes') self.assertEqual(properties['_is_on_discounted_plan'], 'no') self._change_to_probono(self.community.name, ProBonoStatus.DISCOUNTED) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_discounted_plan'], 'yes')
def test_probono_properties(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_pro_bono_plan'], 'no') self._change_to_probono(self.community.name, ProBonoStatus.YES) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_pro_bono_plan'], 'yes') self.assertEqual(properties['_is_on_discounted_plan'], 'no') self._change_to_probono(self.community.name, ProBonoStatus.DISCOUNTED) properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_discounted_plan'], 'yes')
def test_properties(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_community_plan'], 'yes') self.assertEqual(properties['_is_on_standard_plan'], 'no') self.assertEqual(properties['_is_on_pro_plan'], 'no') self.assertEqual(properties['_max_edition_of_paying_plan'], SoftwarePlanEdition.ENTERPRISE)
def user_save_callback(sender, **kwargs): couch_user = kwargs.get("couch_user", None) if couch_user and couch_user.is_web_user(): properties = {} properties.update(get_subscription_properties_by_user(couch_user)) properties.update(get_domain_membership_properties(couch_user)) identify_v2.delay(couch_user.username, properties) update_hubspot_properties_v2.delay(couch_user, properties)
def user_save_callback(sender, **kwargs): couch_user = kwargs.get("couch_user", None) if couch_user and couch_user.is_web_user(): properties = {} properties.update(get_subscription_properties_by_user(couch_user)) properties.update(get_domain_membership_properties(couch_user)) identify.delay(couch_user.username, properties) update_hubspot_properties.delay(couch_user, properties)
def get_user_data(cls, couch_user, property_names): hubspot_properties = {} hubspot_properties.update(get_subscription_properties_by_user(couch_user)) hubspot_properties.update(get_domain_membership_properties(couch_user)) hubspot_properties.update(get_ab_test_properties(couch_user)) try: data = [{"property": prop, "value": hubspot_properties[prop]} for prop in property_names] except KeyError: raise CommandError("Property should be one of following\n{}".format( list(hubspot_properties) )) user_data = { "email": couch_user.email, "properties": data } return user_data
def get_user_data(cls, couch_user, property_names): hubspot_properties = {} hubspot_properties.update( get_subscription_properties_by_user(couch_user)) hubspot_properties.update(get_domain_membership_properties(couch_user)) hubspot_properties.update(get_ab_test_properties(couch_user)) try: data = [{ "property": prop, "value": hubspot_properties[prop] } for prop in property_names] except KeyError: raise CommandError( "Property should be one of following\n{}".format( list(hubspot_properties))) user_data = {"email": couch_user.email, "properties": data} return user_data
def test_properties(self): properties = get_subscription_properties_by_user(self.user) self.assertEqual(properties['_is_on_community_plan'], 'yes') self.assertEqual(properties['_is_on_standard_plan'], 'no') self.assertEqual(properties['_is_on_pro_plan'], 'no') self.assertEqual(properties['_max_edition_of_paying_plan'], SoftwarePlanEdition.ENTERPRISE)