refactor: migrated FEATURES dict settings to top-level in core files and fixed related test files. (#37389)

* refactor: moved remaining feature dicts settings into top-level settings.

* refactor: moved remaining feature dicts settings into top-level settings.

* fix: fixed the test files

* fix: fixed tehe pylint errors

* fix: fixation of the cms ci failure

* fix: fixed remaining feature settings for cms

* fix: added fix for requirements

* fix: added fix for lms tests

* fix: resolved the test views issue

* fix: configured views file and test_views

* fix: fixed lint errors and assertion issues

* fix: added fix for base url issue in test view

* fix: added fix for base_url and assertion issue

* fix: added configurations for base utl fix

* fix: handled none issue for mfe config

* fix: corrected override settings in test views

* fix: added getattr defensive technique for view settings

* fix: reverted views and test_views file

* fix: added settings in views file

* fix: added with patch within functions in test view

* fix: rearranged the features in default_legacy_config

* fix: fixing the tests  with clearing cache

* fix: reverted test views to verify the CI check

* fix: added cache clear in mfe config test

* fix: fixed the patch toggles to override settings

* fix: fixed the lint errors

* fix: changed patch toggle to override settings
This commit is contained in:
Akanshu Aich
2026-01-20 22:25:26 +05:30
committed by GitHub
parent 7ecb6cb79b
commit 2d82d90279
23 changed files with 88 additions and 84 deletions

View File

@@ -681,7 +681,8 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTes
assert access._has_access_course(staff, 'see_in_catalog', course)
assert access._has_access_course(staff, 'see_about_page', course)
@patch.dict("django.conf.settings.FEATURES", {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True})
@patch.dict("django.conf.settings.FEATURES", {'ENABLE_PREREQUISITE_COURSES': True})
@override_settings(MILESTONES_APP=True)
def test_access_on_course_with_pre_requisites(self):
"""
Test course access when a course has pre-requisite course yet to be completed

View File

@@ -5,6 +5,7 @@ Tests use cases related to LMS Entrance Exam behavior, such as gated content acc
from unittest.mock import patch
from crum import set_current_request
from django.test import override_settings
from django.urls import reverse
from milestones.tests.utils import MilestonesTestCaseMixin
from lms.djangoapps.courseware.entrance_exams import (
@@ -36,7 +37,7 @@ from common.djangoapps.util.milestones_helpers import (
)
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
@override_settings(ENTRANCE_EXAMS=True)
class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Check that content is properly gated.
@@ -44,7 +45,7 @@ class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, Milest
Creates a test course from scratch. The tests below are designed to execute
workflows regardless of the feature flag settings.
"""
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
@override_settings(ENTRANCE_EXAMS=True)
def setUp(self):
"""
Test case scaffolding

View File

@@ -8,6 +8,7 @@ import pytest
from crum import set_current_request
from django.contrib.auth.models import AnonymousUser
from django.http import Http404
from django.test import override_settings
from django.urls import reverse
from edx_toggles.toggles.testutils import override_waffle_flag
from milestones.tests.utils import MilestonesTestCaseMixin
@@ -333,12 +334,12 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertContains(resp, self.xml_data)
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
@override_settings(ENTRANCE_EXAMS=True)
class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Validate tab behavior when dealing with Entrance Exams
"""
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
@override_settings(ENTRANCE_EXAMS=True)
def setUp(self):
"""
Test case scaffolding