forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update from_addr for default from bulk emails
* pull request against `master`: Update from_addr for default from bulk emails (openedx#29001) * related openedx issue: openedx/wg-build-test-release#102 Co-authored-by: Kevin Valencia <[email protected]> (cherry picked from commit fa258de)
- Loading branch information
Showing
3 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,7 +175,7 @@ class LocalizedFromAddressPlatformLangTestCase(SendEmailWithMockedUgettextMixin, | |
""" | ||
Tests to ensure that the bulk email has the "From" address localized according to LANGUAGE_CODE. | ||
""" | ||
@override_settings(LANGUAGE_CODE='en') | ||
@override_settings(LANGUAGE_CODE='en', EMAIL_USE_COURSE_ID_FROM_FOR_BULK=True) | ||
def test_english_platform(self): | ||
""" | ||
Ensures that the source-code language (English) works well. | ||
|
@@ -185,7 +185,7 @@ def test_english_platform(self): | |
message = self.send_email() | ||
self.assertRegex(message.from_email, '.*Course Staff.*') | ||
|
||
@override_settings(LANGUAGE_CODE='eo') | ||
@override_settings(LANGUAGE_CODE='eo', EMAIL_USE_COURSE_ID_FROM_FOR_BULK=True) | ||
def test_esperanto_platform(self): | ||
""" | ||
Tests the fake Esperanto language to ensure proper gettext calls. | ||
|
@@ -219,7 +219,7 @@ def setUpClass(cls): | |
default_store=ModuleStoreEnum.Type.split | ||
) | ||
|
||
@override_settings(LANGUAGE_CODE='eo') | ||
@override_settings(LANGUAGE_CODE='eo', EMAIL_USE_COURSE_ID_FROM_FOR_BULK=True) | ||
def test_esperanto_platform_arabic_course(self): | ||
""" | ||
The course language should override the platform's. | ||
|
@@ -248,6 +248,7 @@ def test_email_disabled(self): | |
# We should get back a HttpResponseForbidden (status code 403) | ||
self.assertContains(response, "Email is not enabled for this course.", status_code=403) | ||
|
||
@override_settings(EMAIL_USE_COURSE_ID_FROM_FOR_BULK=True) | ||
@patch('lms.djangoapps.bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) # lint-amnesty, pylint: disable=line-too-long | ||
def test_send_to_self(self): | ||
""" | ||
|
@@ -287,7 +288,7 @@ def test_send_to_staff(self): | |
assert len(mail.outbox) == (1 + len(self.staff)) | ||
assert len([e.to[0] for e in mail.outbox]) == len([self.instructor.email] + [s.email for s in self.staff]) | ||
|
||
@override_settings(DEFAULT_FROM_EMAIL='[email protected]', EMAIL_USE_DEFAULT_FROM_FOR_BULK=True) | ||
@override_settings(DEFAULT_FROM_EMAIL='[email protected]', BULK_EMAIL_DEFAULT_FROM_EMAIL=None, EMAIL_USE_COURSE_ID_FROM_FOR_BULK=False) # lint-amnesty, pylint: disable=line-too-long | ||
def test_email_from_address(self): | ||
""" | ||
Make sure the from_address should be the DEFAULT_FROM_EMAIL when corresponding flag is enabled. | ||
|
@@ -497,7 +498,7 @@ def test_unicode_students_send_to_all(self): | |
assert len([e.to[0] for e in mail.outbox]) ==\ | ||
len([self.instructor.email] + [s.email for s in self.staff] + [s.email for s in self.students]) | ||
|
||
@override_settings(BULK_EMAIL_DEFAULT_FROM_EMAIL="[email protected]") | ||
@override_settings(BULK_EMAIL_DEFAULT_FROM_EMAIL="[email protected]", EMAIL_USE_COURSE_ID_FROM_FOR_BULK=True) # lint-amnesty, pylint: disable=line-too-long | ||
def test_long_course_display_name(self): | ||
""" | ||
This test tests that courses with exorbitantly large display names | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters