Certificate Display Settings revamp (round 2) (#28286)
feat: reimagine certificate display settings The course settings `certificate_available_date` (CAD) and `certificates_display_behavior` (CDB) were previously acting indedependantly of one another. They now work in tandem. This change: - limits CDB to a dropdown - removes "early_with_info" and adds "end_with_date" - only takes CAD into account if "end_with_date" is selected - Moves CDB to the main course schedule settings page - updates CourseOverview model and CourseDetails objects to validate these fields and choose sane defaults if they aren't expected values This work was previously done in bd9e7dd (complete with bugs), so this version is toggleable via the ENABLE_V2_CERT_DISPLAY_SETTINGS setting
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Tests for courseware API
|
||||
"""
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import urlencode
|
||||
from typing import Optional
|
||||
|
||||
@@ -39,6 +39,7 @@ from common.djangoapps.student.roles import CourseInstructorRole
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentCelebrationFactory, UserFactory
|
||||
from openedx.core.djangoapps.agreements.api import create_integrity_signature
|
||||
from openedx.core.djangoapps.agreements.toggles import ENABLE_INTEGRITY_SIGNATURE
|
||||
from xmodule.data import CertificatesDisplayBehaviors
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, ToyCourseFactory
|
||||
@@ -46,6 +47,8 @@ from xmodule.modulestore.tests.factories import ItemFactory, ToyCourseFactory
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
_NEXT_WEEK = datetime.now() + timedelta(days=7)
|
||||
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
class BaseCoursewareTests(SharedModuleStoreTestCase):
|
||||
@@ -64,6 +67,8 @@ class BaseCoursewareTests(SharedModuleStoreTestCase):
|
||||
enrollment_end=datetime(2028, 1, 1, 1, 1, 1),
|
||||
emit_signals=True,
|
||||
modulestore=cls.store,
|
||||
certificate_available_date=_NEXT_WEEK,
|
||||
certificates_display_behavior=CertificatesDisplayBehaviors.END_WITH_DATE
|
||||
)
|
||||
cls.chapter = ItemFactory(parent=cls.course, category='chapter')
|
||||
cls.sequence = ItemFactory(parent=cls.chapter, category='sequential', display_name='sequence')
|
||||
|
||||
Reference in New Issue
Block a user