Skip to content

Commit 65c8cdf

Browse files
feanilclaude
andcommitted
fix: skip third_party_auth settings tests under CMS and guard enterprise pipeline
The settings tests were failing when run with CMS settings because the third_party_auth settings (SOCIAL_AUTH_PIPELINE, ExceptionMiddleware, etc.) are now defined only in lms/envs/common.py. Investigation confirmed CMS does not need these settings: - CMS has no social auth URL endpoints (third_party_auth URLs only included in LMS when ENABLE_THIRD_PARTY_AUTH is true) - CMS uses EdxDjangoStrategy for OAuth2 SSO with LMS, not ConfigurationModelStrategy for third-party identity providers - CMS authentication backends are EdXOAuth2 (LMS SSO) and LtiAuthenticationBackend, not social auth backends - The third_party_auth app is only in cms/envs/test.py INSTALLED_APPS to avoid import errors from indirect dependencies (like enterprise) Changes: - Added @skip_unless_lms decorator to SettingsUnitTest class - Added hasattr guard for SOCIAL_AUTH_PIPELINE in apps.py to prevent AttributeError when running under CMS (which doesn't have this setting) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 345348d commit 65c8cdf

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

common/djangoapps/third_party_auth/apps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ def ready(self):
1616
# However, the enterprise pipeline step must be inserted dynamically because
1717
# it requires checking if enterprise is enabled, which can't be done at
1818
# settings load time.
19-
from openedx.features.enterprise_support.api import insert_enterprise_pipeline_elements
20-
insert_enterprise_pipeline_elements(settings.SOCIAL_AUTH_PIPELINE)
19+
# Only insert enterprise elements if SOCIAL_AUTH_PIPELINE exists (LMS only, not CMS).
20+
if hasattr(settings, 'SOCIAL_AUTH_PIPELINE'):
21+
from openedx.features.enterprise_support.api import insert_enterprise_pipeline_elements
22+
insert_enterprise_pipeline_elements(settings.SOCIAL_AUTH_PIPELINE)

common/djangoapps/third_party_auth/tests/test_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
from common.djangoapps.third_party_auth import provider
77
from common.djangoapps.third_party_auth.tests.utils import skip_unless_thirdpartyauth
8+
from openedx.core.djangolib.testing.utils import skip_unless_lms
89

910

11+
@skip_unless_lms
1012
class SettingsUnitTest(TestCase):
1113
"""Unit tests for third-party auth settings defined in lms/envs/common.py."""
1214

0 commit comments

Comments
 (0)