-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix and refactor task annd signals responsible for syncing cert …
…available date updates to 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.
- Loading branch information
1 parent
da244a9
commit d98c466
Showing
8 changed files
with
574 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" | ||
Python APIs exposed by the credentials app to other in-process apps. | ||
""" | ||
|
||
|
||
from openedx.core.djangoapps.credentials.models import CredentialsApiConfig | ||
|
||
|
||
def is_credentials_enabled(): | ||
""" | ||
A utility function wrapping the `is_learner_issurance_enabled` utility function of the CredentialsApiConfig model. | ||
Intended to be an easier to read/grok utility function that informs the caller if use of the Credentials IDA is | ||
enabled for this Open edX instance. | ||
""" | ||
return CredentialsApiConfig.current().is_learner_issuance_enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
||
class CredentialsApiTests(CredentialsApiConfigMixin, TestCase): | ||
""" | ||
Tests for the Public Pyton API exposed by the credentials Django app. | ||
""" | ||
|
||
def setUp(self): | ||
super().setUp() | ||
|
||
def tearDown(self): | ||
CredentialsApiConfig.objects.all().delete() | ||
super().tearDown() | ||
|
||
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() | ||
|
||
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() | ||
|
||
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() |
Oops, something went wrong.