Skip to content

Commit b70557d

Browse files
feanilclaude
andcommitted
refactor: migrate ENABLE_INSTRUCTOR_EMAIL and REQUIRE_COURSE_EMAIL_AUTH off FEATURES-as-dict
Three bulk_email test classes carried `@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})`. Neither FEATURES key is read anywhere in the platform or the installed packages anymore — bulk email enablement is now governed by the BulkEmailFlag waffle flag and the CourseAuthorization model — so these class-level overrides are vestigial no-ops (and, being class-level `patch.dict`, only ever wrapped the `test_*` methods, not setUp). Both flags sit in a single decorator dict, so they migrate together: convert to `@override_settings(ENABLE_INSTRUCTOR_EMAIL=True, REQUIRE_COURSE_EMAIL_AUTH=False)`. Behavior is unchanged (still unread); this just removes the FEATURES-dict usage. The classes subclass SharedModuleStoreTestCase, so the class-level override_settings is valid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9945300 commit b70557d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lms/djangoapps/bulk_email/tests/test_email.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def mock_ugettext(text):
182182
return mail.outbox[0]
183183

184184

185-
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
185+
@override_settings(ENABLE_INSTRUCTOR_EMAIL=True, REQUIRE_COURSE_EMAIL_AUTH=False)
186186
@ddt.ddt
187187
class LocalizedFromAddressPlatformLangTestCase(SendEmailWithMockedUgettextMixin, EmailSendFromDashboardTestCase):
188188
"""
@@ -210,7 +210,7 @@ def test_english_platform(self, language_code, enable_use_corse_id_in_from, ace_
210210
self.assertRegex(message.from_email, f'{language_code.upper()} .* Course Staff') # noqa: PT009
211211

212212

213-
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
213+
@override_settings(ENABLE_INSTRUCTOR_EMAIL=True, REQUIRE_COURSE_EMAIL_AUTH=False)
214214
@ddt.ddt
215215
class AceEmailTestCase(SendEmailWithMockedUgettextMixin, EmailSendFromDashboardTestCase):
216216
"""
@@ -268,7 +268,7 @@ def test_keyword_substitution_in_message_body(self):
268268
self.assertIn(f'Welcome to {self.course.display_name}', html_message_body) # noqa: PT009
269269

270270

271-
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
271+
@override_settings(ENABLE_INSTRUCTOR_EMAIL=True, REQUIRE_COURSE_EMAIL_AUTH=False)
272272
@ddt.ddt
273273
class LocalizedFromAddressCourseLangTestCase(SendEmailWithMockedUgettextMixin, EmailSendFromDashboardTestCase):
274274
"""

0 commit comments

Comments
 (0)