diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py index 0df1d661c5..e812ae286a 100644 --- a/lms/djangoapps/certificates/api.py +++ b/lms/djangoapps/certificates/api.py @@ -351,33 +351,6 @@ def cert_generation_enabled(course_key): ) -def generate_example_certificates(course_key): - """Generate example (PDF) certificates for a course. - - Example certificates were used to validate that certificates were configured correctly for the course. Staff - members could view the example certificates before enabling the self-generated certificates button for students. - - [07/20/2021 Update] - This function was updated to remove the references to queue.py, which has been removed as part of MICROBA-1227, and - no longer can fulfill the function it was originally created for. There is further cleanup around PDF certificate - generation code, part of DEPR-155, that will remove this function. See DEPR-155 and MICROBA-1094 for additional - info. - - It may be important to note that this functionality has been broken since 2018 when the ability to generate PDF - certificates was ripped out of edx-platform. This will be removed as part of MICROBA-1394. - - Arguments: - course_key (CourseKey): The course identifier. - - Returns: - None - """ - log.warning( - "Generating example certificates is no longer supported. Skipping generation of example certificates for " - f"course {course_key}" - ) - - def example_certificates_status(course_key): """Check the status of example certificates for a course. diff --git a/lms/djangoapps/instructor/tests/test_certificates.py b/lms/djangoapps/instructor/tests/test_certificates.py index d0bd772564..52ff4faa96 100644 --- a/lms/djangoapps/instructor/tests/test_certificates.py +++ b/lms/djangoapps/instructor/tests/test_certificates.py @@ -14,7 +14,6 @@ from django.core.exceptions import ObjectDoesNotExist from django.core.files.uploadedfile import SimpleUploadedFile from django.test.utils import override_settings from django.urls import reverse -from testfixtures import LogCapture from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import GlobalStaffFactory @@ -229,7 +228,7 @@ class CertificatesInstructorApiTest(SharedModuleStoreTestCase): cache.clear() CertificateGenerationConfiguration.objects.create(enabled=True) - @ddt.data('generate_example_certificates', 'enable_certificate_generation') + @ddt.data('enable_certificate_generation') def test_allow_only_global_staff(self, url_name): url = reverse(url_name, kwargs={'course_id': self.course.id}) @@ -243,28 +242,6 @@ class CertificatesInstructorApiTest(SharedModuleStoreTestCase): response = self.client.post(url) assert response.status_code == 302 - def test_generate_example_certificates(self): - expected_log_message = ( - "Generating example certificates is no longer supported. Skipping generation of example certificates for " - f"course {self.course.id}" - ) - - self.client.login(username=self.global_staff.username, password='test') - url = reverse( - 'generate_example_certificates', - kwargs={'course_id': str(self.course.id)} - ) - logging_messages = None - with LogCapture() as log: - response = self.client.post(url) - logging_messages = [log_msg.getMessage() for log_msg in log.records] - - assert logging_messages is not None - assert expected_log_message in logging_messages - - # Expect a redirect back to the instructor dashboard - self._assert_redirects_to_instructor_dash(response) - @ddt.data(True, False) def test_enable_certificate_generation(self, is_enabled): self.client.login(username=self.global_staff.username, password='test') diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 3b828ea9fa..e431e6b39c 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2825,23 +2825,6 @@ def _instructor_dash_url(course_key, section=None): return url -@require_global_staff -@require_POST -def generate_example_certificates(request, course_id=None): - """Start generating a set of example certificates. - - Example certificates are used to verify that certificates have - been configured correctly for the course. - - Redirects back to the instructor dashboard once certificate - generation has begun. - - """ - course_key = CourseKey.from_string(course_id) - certs_api.generate_example_certificates(course_key) - return redirect(_instructor_dash_url(course_key, section='certificates')) - - @require_course_permission(permissions.ENABLE_CERTIFICATE_GENERATION) @require_POST def enable_certificate_generation(request, course_id=None): diff --git a/lms/djangoapps/instructor/views/api_urls.py b/lms/djangoapps/instructor/views/api_urls.py index 6a0b7d1e8e..abf8712e43 100644 --- a/lms/djangoapps/instructor/views/api_urls.py +++ b/lms/djangoapps/instructor/views/api_urls.py @@ -79,7 +79,6 @@ urlpatterns = [ url(r'^add_users_to_cohorts$', api.add_users_to_cohorts, name='add_users_to_cohorts'), # Certificates - url(r'^generate_example_certificates$', api.generate_example_certificates, name='generate_example_certificates'), url(r'^enable_certificate_generation$', api.enable_certificate_generation, name='enable_certificate_generation'), url(r'^start_certificate_generation', api.start_certificate_generation, name='start_certificate_generation'), url(r'^start_certificate_regeneration', api.start_certificate_regeneration, name='start_certificate_regeneration'), diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 5e277598ba..4b05b89059 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -342,10 +342,6 @@ def _section_certificates(course): 'certificate_generation_history': CertificateGenerationHistory.objects.filter(course_id=course.id).order_by("-created"), 'urls': { - 'generate_example_certificates': reverse( - 'generate_example_certificates', - kwargs={'course_id': course.id} - ), 'enable_certificate_generation': reverse( 'enable_certificate_generation', kwargs={'course_id': course.id} diff --git a/lms/templates/instructor/instructor_dashboard_2/certificates.html b/lms/templates/instructor/instructor_dashboard_2/certificates.html index 7d23e61d37..0b993a0483 100644 --- a/lms/templates/instructor/instructor_dashboard_2/certificates.html +++ b/lms/templates/instructor/instructor_dashboard_2/certificates.html @@ -21,12 +21,15 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str

${_('Example Certificates')}

-

${_('Generate example certificates for the course.')}

- -
- - -
+

+ ${_('This course is configured to generate PDF certificates and this certificate type is no longer supported. Example certificates cannot be generated.')} +

+ +
% endif @@ -68,7 +71,9 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str % else: -

${_("You must successfully generate example certificates before you enable student-generated certificates.")}

+

+ ${_("You must successfully generate example certificates before you enable student-generated certificates.")} +

% endif