From ed8604534c0210f99125546b092edaaea3bdb3f9 Mon Sep 17 00:00:00 2001 From: Matt Tuchfarber Date: Tue, 16 Mar 2021 14:31:11 -0400 Subject: [PATCH] (feat) Enable course cert sync for all courses Removes waffle flag restriction for syncing certificate available dates to the credentials service. --- .../core/djangoapps/models/config/__init__.py | 0 .../core/djangoapps/models/config/waffle.py | 36 ------------------- openedx/core/djangoapps/programs/signals.py | 4 --- .../djangoapps/programs/tests/test_signals.py | 10 ++---- 4 files changed, 3 insertions(+), 47 deletions(-) delete mode 100644 openedx/core/djangoapps/models/config/__init__.py delete mode 100644 openedx/core/djangoapps/models/config/waffle.py diff --git a/openedx/core/djangoapps/models/config/__init__.py b/openedx/core/djangoapps/models/config/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openedx/core/djangoapps/models/config/waffle.py b/openedx/core/djangoapps/models/config/waffle.py deleted file mode 100644 index e0d798456a..0000000000 --- a/openedx/core/djangoapps/models/config/waffle.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -This module contains various configuration settings via -waffle switches for the course_details view. -""" - - -from edx_toggles.toggles import LegacyWaffleFlagNamespace, LegacyWaffleSwitchNamespace -from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag - -COURSE_DETAIL_WAFFLE_NAMESPACE = 'course_detail' -COURSE_DETAIL_WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE) -WAFFLE_SWITCHES = LegacyWaffleSwitchNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE) - -# Course Override Flag -COURSE_DETAIL_UPDATE_CERTIFICATE_DATE = 'course_detail_update_certificate_date' - - -def waffle_flags(): - """ - Returns the namespaced, cached, audited Waffle flags dictionary for course detail. - """ - return { - COURSE_DETAIL_UPDATE_CERTIFICATE_DATE: CourseWaffleFlag( - waffle_namespace=COURSE_DETAIL_WAFFLE_NAMESPACE, - flag_name=COURSE_DETAIL_UPDATE_CERTIFICATE_DATE, - module_name=__name__, - ) - } - - -def enable_course_detail_update_certificate_date(course_id): - """ - Returns True if course_detail_update_certificate_date course override flag is enabled, - otherwise False. - """ - return waffle_flags()[COURSE_DETAIL_UPDATE_CERTIFICATE_DATE].is_enabled(course_id) diff --git a/openedx/core/djangoapps/programs/signals.py b/openedx/core/djangoapps/programs/signals.py index d70a8015ed..ce70ffa189 100644 --- a/openedx/core/djangoapps/programs/signals.py +++ b/openedx/core/djangoapps/programs/signals.py @@ -8,7 +8,6 @@ import logging from django.dispatch import receiver from openedx.core.djangoapps.credentials.helpers import is_learner_records_enabled_for_org -from openedx.core.djangoapps.models.config.waffle import enable_course_detail_update_certificate_date from openedx.core.djangoapps.signals.signals import ( COURSE_CERT_AWARDED, COURSE_CERT_CHANGED, @@ -196,9 +195,6 @@ def handle_course_cert_date_change(sender, course_key, available_date, **kwargs) None """ - # Stop if cert date updating isn't in effect for the course - if not enable_course_detail_update_certificate_date(course_key): - return # Import here instead of top of file since this module gets imported before # the credentials app is loaded, resulting in a Django deprecation warning. diff --git a/openedx/core/djangoapps/programs/tests/test_signals.py b/openedx/core/djangoapps/programs/tests/test_signals.py index a8006cfd3f..67ef164e79 100644 --- a/openedx/core/djangoapps/programs/tests/test_signals.py +++ b/openedx/core/djangoapps/programs/tests/test_signals.py @@ -239,7 +239,6 @@ class CertRevokedReceiverTest(TestCase): new_callable=mock.PropertyMock, return_value=False, ) -@mock.patch("openedx.core.djangoapps.programs.signals.enable_course_detail_update_certificate_date") class CourseCertAvailableDateChangedReceiverTest(TestCase): """ Tests for the `handle_course_cert_date_change` signal handler function. @@ -256,7 +255,7 @@ class CourseCertAvailableDateChangedReceiverTest(TestCase): 'available_date': datetime.datetime.now() } - def test_signal_received(self, mock_enable_update, mock_is_learner_issuance_enabled, mock_task): # pylint: disable=unused-argument + def test_signal_received(self, mock_is_learner_issuance_enabled, mock_task): # pylint: disable=unused-argument """ Ensures the receiver function is invoked when COURSE_CERT_DATE_CHANGE is sent. @@ -265,26 +264,23 @@ class CourseCertAvailableDateChangedReceiverTest(TestCase): to the way django signals work), we mock a configuration call that is known to take place inside the function. """ - mock_enable_update.return_value = True COURSE_CERT_DATE_CHANGE.send(**self.signal_kwargs) assert mock_is_learner_issuance_enabled.call_count == 1 - def test_programs_disabled(self, mock_enable_update, mock_is_learner_issuance_enabled, mock_task): + def test_programs_disabled(self, mock_is_learner_issuance_enabled, mock_task): """ Ensures that the receiver function does nothing when the credentials API configuration is not enabled. """ - mock_enable_update.return_value = True handle_course_cert_date_change(**self.signal_kwargs) assert mock_is_learner_issuance_enabled.call_count == 1 assert mock_task.call_count == 0 - def test_programs_enabled(self, mock_enable_update, mock_is_learner_issuance_enabled, mock_task): + def test_programs_enabled(self, mock_is_learner_issuance_enabled, mock_task): """ Ensures that the receiver function invokes the expected celery task when the credentials API configuration is enabled. """ - mock_enable_update.return_value = True mock_is_learner_issuance_enabled.return_value = True handle_course_cert_date_change(**self.signal_kwargs)