(feat) Enable course cert sync for all courses
Removes waffle flag restriction for syncing certificate available dates to the credentials service.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user