Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions common/djangoapps/util/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ def course_filename_prefix_generator(course_id, separator='_'):
course_id.run
])

enable_course_filename_ccx_suffix = settings.FEATURES.get(
'ENABLE_COURSE_FILENAME_CCX_SUFFIX',
False
enable_course_filename_ccx_suffix = getattr(
settings, 'ENABLE_COURSE_FILENAME_CCX_SUFFIX', False
)

if enable_course_filename_ccx_suffix and getattr(course_id, 'ccx', None):
Expand Down
4 changes: 2 additions & 2 deletions common/djangoapps/util/tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_locators(self, course_key):
[CCXLocator.from_course_locator(CourseLocator(org='foo', course='bar', run='baz'), '1'), 'foo_bar_baz_ccx_1'],
)
@ddt.unpack
@override_settings(FEATURES={'ENABLE_COURSE_FILENAME_CCX_SUFFIX': True})
@override_settings(ENABLE_COURSE_FILENAME_CCX_SUFFIX=True)
def test_include_ccx_id(self, course_key, expected_filename):
"""
Test filename prefix genaration from multiple course key formats.
Expand All @@ -82,7 +82,7 @@ def test_custom_separator(self, course_key):
[CCXLocator.from_course_locator(CourseLocator(org='foo', course='bar', run='baz'), '1'), 'foo-bar-baz-ccx-1'],
)
@ddt.unpack
@override_settings(FEATURES={'ENABLE_COURSE_FILENAME_CCX_SUFFIX': True})
@override_settings(ENABLE_COURSE_FILENAME_CCX_SUFFIX=True)
def test_custom_separator_including_ccx_id(self, course_key, expected_filename):
"""
Test filename prefix is generated with a custom separator.
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/bulk_email/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def mock_ugettext(text):
return mail.outbox[0]


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


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


@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
@override_settings(ENABLE_INSTRUCTOR_EMAIL=True, REQUIRE_COURSE_EMAIL_AUTH=False)
@ddt.ddt
class LocalizedFromAddressCourseLangTestCase(SendEmailWithMockedUgettextMixin, EmailSendFromDashboardTestCase):
"""
Expand Down
16 changes: 7 additions & 9 deletions lms/djangoapps/learner_home/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

ENTERPRISE_ENABLED = "ENABLE_ENTERPRISE_INTEGRATION"


@ddt.ddt
class TestGetPlatformSettings(TestCase):
Expand Down Expand Up @@ -573,7 +571,7 @@ def _create_course_programs(self, course_uuid=None):

return (program, enrollment, entitlement)

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
def test_response_structure(self):
"""Basic test for correct response structure"""

Expand All @@ -600,7 +598,7 @@ def test_response_structure(self):

assert expected_keys == response_data.keys()

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
def test_response_course_advertised_start(self):
"""Basic test for correct response structure"""

Expand Down Expand Up @@ -629,7 +627,7 @@ def test_response_course_advertised_start(self):
assert "advertisedStart" in course_run
assert course_run["advertisedStart"] == advertised_start

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
@patch("lms.djangoapps.learner_home.views.get_user_account_confirmation_info")
def test_email_confirmation(self, mock_user_conf_info):
"""Test that email confirmation info passes through correctly"""
Expand Down Expand Up @@ -658,7 +656,7 @@ def test_email_confirmation(self, mock_user_conf_info):
},
)

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
@patch("lms.djangoapps.learner_home.views.cert_info")
def test_get_cert_statuses(self, mock_get_cert_info):
"""Test that cert information gets loaded correctly"""
Expand Down Expand Up @@ -699,7 +697,7 @@ def test_get_cert_statuses(self, mock_get_cert_info):
},
)

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
@patch("lms.djangoapps.learner_home.views.cert_info")
def test_get_cert_statuses_exception(self, mock_get_cert_info):
"""Test that cert information gets loaded correctly"""
Expand Down Expand Up @@ -735,7 +733,7 @@ def test_get_cert_statuses_exception(self, mock_get_cert_info):
response_data["courses"][0]["certificate"], empty_cert_data
)

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
@patch("openedx.core.djangoapps.programs.utils.get_programs")
def test_get_for_one_of_course_programs(self, mock_get_programs):
"""Test that course programs get loaded correctly"""
Expand All @@ -758,7 +756,7 @@ def test_get_for_one_of_course_programs(self, mock_get_programs):
assert programs[course_uuid][0] == program
assert len(data) > len(programs)

@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
@override_settings(ENTERPRISE_ENABLED=False)
@patch("openedx.core.djangoapps.programs.utils.get_programs")
def test_get_multiple_course_programs(self, mock_get_programs):
"""Test that course programs get loaded correctly"""
Expand Down
Loading