Skip to content
Snippets Groups Projects
Commit 8e2cdc2d authored by adeelehsan's avatar adeelehsan
Browse files

Used smart_str instead of str

parent edd8322e
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ def update_sailthru(sender, user, mode, course_id, **kwargs): # pylint: disable
None
"""
if WAFFLE_SWITCHES.is_enabled(SAILTHRU_AUDIT_PURCHASE_ENABLED) and mode in CourseMode.AUDIT_MODES:
email = str(user.email)
email = user.email.encode('utf-8')
update_course_enrollment.delay(email, course_id, mode, site=_get_current_site())
......
# -*- coding: utf-8 -*-
"""Tests of email marketing signal handlers."""
from __future__ import absolute_import
......@@ -678,3 +680,14 @@ class SailthruTests(TestCase):
switch.return_value = True
update_sailthru(None, self.user, 'verified', self.course_id)
self.assertFalse(mock_sailthru_purchase.called)
@patch('openedx.core.djangoapps.waffle_utils.WaffleSwitchNamespace.is_enabled')
@patch('sailthru.sailthru_client.SailthruClient.purchase')
def test_encoding_is_working_for_email_contains_unicode(self, mock_sailthru_purchase, switch):
"""Make sure encoding is working for emails contains unicode characters
while sending it to sail through.
"""
switch.return_value = True
self.user.email = u'tèst@edx.org'
update_sailthru(None, self.user, 'audit', self.course_id)
self.assertTrue(mock_sailthru_purchase.called)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment