Skip to content

Conversation

@cp-at-mit
Copy link
Contributor

What are the relevant tickets?

NA

Description (What does it do?)

How can this be tested?

The create_run_enrollments function now defaults the keep_failed_enrollments parameter to the IGNORE_EDX_FAILURES feature flag if not explicitly set. Added tests to verify that the function respects both the parameter and the feature flag.
Change deactivate_run_enrollment so keep_failed_enrollments defaults to None and, when None, is set from the IGNORE_EDX_FAILURES feature flag (is_enabled(features.IGNORE_EDX_FAILURES)). Update the function docstring accordingly and add tests (test_deactivate_run_enrollment_feature_flag) to verify behavior for None and explicit True/False values by mocking is_enabled and unenroll_edx_course_run.
Replace direct calls to mitol.olposthog.features.is_enabled with settings.FEATURES.get(features.IGNORE_EDX_FAILURES, False) across courses serializers and views to read the IGNORE_EDX_FAILURES flag from Django settings. Remove unused is_enabled imports and add django.conf.settings imports where needed. In users.views, add logging and robust error handling around queuing edX tasks: failures are logged and will only propagate when the IGNORE_EDX_FAILURES flag is disabled. Add tests to verify behavior of user update when edX task queuing fails and the feature flag is toggled. Files changed include courses/api.py, courses/serializers/v1/courses.py, courses/views/v1/__init__.py, courses/views/v2/__init__.py, users/views.py and users/views_test.py.
Add logging and error handling around syncing enrollments with edX in UserEnrollmentsApiViewSet.list. The view now catches exceptions from sync_enrollments_with_edx, logs the failure, and will re-raise only if the FEATURES flag IGNORE_EDX_FAILURES is not set. Also add parameterized tests to verify behavior across combinations of SYNC_ON_DASHBOARD_LOAD, IGNORE_EDX_FAILURES, and sync failures.
@github-actions
Copy link

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:


## Changes for v1.yaml:


## Changes for v2.yaml:


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

pre-commit-ci bot and others added 14 commits January 30, 2026 21:01
Add import of mitol.olposthog.features.is_enabled to courses.views v1 and v2. Update tests: remove an obsolete 404 assertion in courses/views/v2/views_test.py, and change users/views_test.py to mock settings.FEATURES.get (with updated comment) instead of users.views.is_enabled. These changes align imports and test mocking with the app's feature-flag handling.
@cp-at-mit cp-at-mit marked this pull request as ready for review February 2, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants