Skip to content

Commit 9945300

Browse files
feanilclaude
andcommitted
refactor: migrate ENTERPRISE_ENABLED off FEATURES-as-dict
The learner_home view tests carried seven `@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)` decorators. Note this is the kwarg form, so it set a FEATURES key literally named 'ENTERPRISE_ENABLED' — which nothing in the codebase reads (the enterprise dashboard is gated by ENABLE_ENTERPRISE_INTEGRATION). The nearby module constant `ENTERPRISE_ENABLED = "ENABLE_ENTERPRISE_INTEGRATION"` was never referenced by these kwargs, so the override has always been a no-op; it looks like the author intended to disable ENABLE_ENTERPRISE_INTEGRATION. This change is scoped to getting off the FEATURES dict, not fixing the latent no-op: convert the decorators to the equivalent `@override_settings(ENTERPRISE_ENABLED=False)` (behavior identical — still sets an unread flat attribute) and drop the now-dead, misleading constant. A follow-up could decide whether these tests meant to assert the enterprise-disabled path via ENABLE_ENTERPRISE_INTEGRATION. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fb5d598 commit 9945300

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

lms/djangoapps/learner_home/test_views.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
4545
from xmodule.modulestore.tests.factories import CourseFactory
4646

47-
ENTERPRISE_ENABLED = "ENABLE_ENTERPRISE_INTEGRATION"
48-
4947

5048
@ddt.ddt
5149
class TestGetPlatformSettings(TestCase):
@@ -573,7 +571,7 @@ def _create_course_programs(self, course_uuid=None):
573571

574572
return (program, enrollment, entitlement)
575573

576-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
574+
@override_settings(ENTERPRISE_ENABLED=False)
577575
def test_response_structure(self):
578576
"""Basic test for correct response structure"""
579577

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

601599
assert expected_keys == response_data.keys()
602600

603-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
601+
@override_settings(ENTERPRISE_ENABLED=False)
604602
def test_response_course_advertised_start(self):
605603
"""Basic test for correct response structure"""
606604

@@ -629,7 +627,7 @@ def test_response_course_advertised_start(self):
629627
assert "advertisedStart" in course_run
630628
assert course_run["advertisedStart"] == advertised_start
631629

632-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
630+
@override_settings(ENTERPRISE_ENABLED=False)
633631
@patch("lms.djangoapps.learner_home.views.get_user_account_confirmation_info")
634632
def test_email_confirmation(self, mock_user_conf_info):
635633
"""Test that email confirmation info passes through correctly"""
@@ -658,7 +656,7 @@ def test_email_confirmation(self, mock_user_conf_info):
658656
},
659657
)
660658

661-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
659+
@override_settings(ENTERPRISE_ENABLED=False)
662660
@patch("lms.djangoapps.learner_home.views.cert_info")
663661
def test_get_cert_statuses(self, mock_get_cert_info):
664662
"""Test that cert information gets loaded correctly"""
@@ -699,7 +697,7 @@ def test_get_cert_statuses(self, mock_get_cert_info):
699697
},
700698
)
701699

702-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
700+
@override_settings(ENTERPRISE_ENABLED=False)
703701
@patch("lms.djangoapps.learner_home.views.cert_info")
704702
def test_get_cert_statuses_exception(self, mock_get_cert_info):
705703
"""Test that cert information gets loaded correctly"""
@@ -735,7 +733,7 @@ def test_get_cert_statuses_exception(self, mock_get_cert_info):
735733
response_data["courses"][0]["certificate"], empty_cert_data
736734
)
737735

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

761-
@patch.dict(settings.FEATURES, ENTERPRISE_ENABLED=False)
759+
@override_settings(ENTERPRISE_ENABLED=False)
762760
@patch("openedx.core.djangoapps.programs.utils.get_programs")
763761
def test_get_multiple_course_programs(self, mock_get_programs):
764762
"""Test that course programs get loaded correctly"""

0 commit comments

Comments
 (0)