Reverting celery task kwarg name.
This commit is contained in:
@@ -198,7 +198,7 @@ def email_marketing_user_field_changed(sender, user=None, table=None, setting=No
|
||||
|
||||
# set the activation flag when the user is marked as activated
|
||||
update_user.delay(_create_sailthru_user_vars(user, user.profile), user.email, site=_get_current_site(),
|
||||
new_user=False, send_welcome_email=send_welcome_email)
|
||||
new_user=False, activation=send_welcome_email)
|
||||
|
||||
elif setting == 'email':
|
||||
# email update is special case
|
||||
|
||||
@@ -60,14 +60,14 @@ def get_email_cookies_via_sailthru(self, user_email, post_parms):
|
||||
|
||||
# pylint: disable=not-callable
|
||||
@task(bind=True, default_retry_delay=3600, max_retries=24, routing_key=ACE_ROUTING_KEY)
|
||||
def update_user(self, sailthru_vars, email, site=None, new_user=False, send_welcome_email=False):
|
||||
def update_user(self, sailthru_vars, email, site=None, new_user=False, activation=False):
|
||||
"""
|
||||
Adds/updates Sailthru profile information for a user.
|
||||
Args:
|
||||
sailthru_vars(dict): User profile information to pass as 'vars' to Sailthru
|
||||
email(str): User email address
|
||||
new_user(boolean): True if new registration
|
||||
send_welcome_email(boolean): True if a welcome email should be sent
|
||||
activation(boolean): True if a welcome email should be sent
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
@@ -96,7 +96,7 @@ def update_user(self, sailthru_vars, email, site=None, new_user=False, send_welc
|
||||
max_retries=email_config.sailthru_max_retries)
|
||||
return
|
||||
|
||||
if send_welcome_email and email_config.sailthru_welcome_template and is_default_site(site) and not \
|
||||
if activation and email_config.sailthru_welcome_template and is_default_site(site) and not \
|
||||
sailthru_vars.get('is_enterprise_learner'):
|
||||
|
||||
scheduled_datetime = datetime.utcnow() + timedelta(seconds=email_config.welcome_email_send_delay)
|
||||
|
||||
@@ -280,14 +280,14 @@ class EmailMarketingTests(TestCase):
|
||||
# force Sailthru API exception on 2nd call
|
||||
mock_log_error.reset_mock()
|
||||
mock_sailthru.side_effect = [SailthruResponse(JsonResponse({'ok': True})), SailthruClientError]
|
||||
update_user.delay({}, self.user.email, send_welcome_email=True)
|
||||
update_user.delay({}, self.user.email, activation=True)
|
||||
self.assertTrue(mock_log_error.called)
|
||||
|
||||
# force Sailthru API error return on 2nd call
|
||||
mock_log_error.reset_mock()
|
||||
mock_sailthru.side_effect = [SailthruResponse(JsonResponse({'ok': True})),
|
||||
SailthruResponse(JsonResponse({'error': 100, 'errormsg': 'Got an error'}))]
|
||||
update_user.delay({}, self.user.email, send_welcome_email=True)
|
||||
update_user.delay({}, self.user.email, activation=True)
|
||||
self.assertTrue(mock_log_error.called)
|
||||
|
||||
@patch('email_marketing.tasks.update_user.retry')
|
||||
|
||||
Reference in New Issue
Block a user