feat: update task and signals responsible for cert available dates in Credentials

[APER-3229]

The monolith and the Credentials IDA keep independent records of a course runs certificate availability/visibility preferences. This PR aims to improve the communication between the monolith and the Credentiala IDA to keep the availability date/preference in sync with the monoliths records.

The current code is too strict and actually prevents valid updates in some configurations.

Additionally, the Credentials IDA doesn't understand the concept of "course pacing" (instructor-paced vs self-paced) and has troubles with courses with an availability date of "end". Instead of having to add the concept of course pacing (and syncing more data between the two systems), this PR proposes sending the end date of a course as the "certificate available date" to Credentials.

This way, the Credentials IDA can manage the visibility of awarded credentials in a course run with a display behavior of "end" using the existing feature set and models of the Credentials service.
This commit is contained in:
Justin Hynes
2024-03-12 11:46:20 +00:00
parent 49c1d7c9f9
commit 8d7a13f358
8 changed files with 571 additions and 287 deletions

View File

@@ -0,0 +1,46 @@
"""
Tests for the utility functions defined as part of the credentials app's public Python API.
"""
from django.test import TestCase
from openedx.core.djangoapps.credentials.api import is_credentials_enabled
from openedx.core.djangoapps.credentials.models import CredentialsApiConfig
from openedx.core.djangoapps.credentials.tests.mixins import CredentialsApiConfigMixin
from openedx.core.djangolib.testing.utils import skip_unless_lms
class CredentialsApiTests(CredentialsApiConfigMixin, TestCase):
"""
Tests for the Public Pyton API exposed by the credentials Django app.
"""
def setUp(self):
super().setUp()
CredentialsApiConfig.objects.all().delete()
@skip_unless_lms
def test_is_credentials_enabled_config_enabled(self):
"""
A test that verifies the output of the `is_credentials_enabled` utility function when a CredentialsApiConfig
exists and is enabled.
"""
self.create_credentials_config(enabled=True)
assert is_credentials_enabled()
@skip_unless_lms
def test_is_credentials_enabled_config_disabled(self):
"""
A test that verifies the output of the `is_credentials_enabled` utility function when a CredentialsApiConfig
exists and is disabled.
"""
self.create_credentials_config(enabled=False)
assert not is_credentials_enabled()
@skip_unless_lms
def test_is_credentials_enabled_config_absent(self):
"""
A test that verifies the output of the `is_credentials_enabled` utility function when a CredentialsApiConfig
does not exist.
"""
assert not is_credentials_enabled()