Merge pull request #7996 from edx/shr/bug/TNL-2119-Unicode-error-in-templating-bulk-course

bulk_email fix course_image_unicode name
This commit is contained in:
Shrhawk
2015-05-15 23:31:01 +05:00
2 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks.
@@ -29,6 +30,8 @@ from celery.states import SUCCESS, FAILURE
from django.conf import settings
from django.core.management import call_command
from xmodule.modulestore.tests.factories import CourseFactory
from bulk_email.models import CourseEmail, Optout, SEND_TO_ALL
from instructor_task.tasks import send_bulk_course_email
@@ -404,3 +407,15 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
def test_failure_on_ses_domain_not_confirmed(self):
self._test_immediate_failure(SESDomainNotConfirmedError(403, "You're out of bounds!"))
def test_bulk_emails_with_unicode_course_image_name(self):
# Test bulk email with unicode characters in course image name
course_image = u'在淡水測試.jpg'
self.course = CourseFactory.create(course_image=course_image)
num_emails = 1
self._create_students(num_emails)
with patch('bulk_email.tasks.get_connection', autospec=True) as get_conn:
get_conn.return_value.send_messages.side_effect = cycle([None])
self._test_run_with_task(send_bulk_course_email, 'emailed', num_emails, num_emails)