Skip to content

Commit

Permalink
feat: [AXIMST-166] Certificates screen additional data
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzniaievdm committed Jan 30, 2024
1 parent 8ea0d75 commit 36a49ec
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ class CourseCertificatesSerializer(serializers.Serializer):
mfe_proctored_exam_settings_url = serializers.CharField(
required=False, allow_null=True, allow_blank=True
)
course_number = serializers.CharField(source="context_course.number")
course_title = serializers.CharField(source="context_course.display_name_with_default")
course_number_override = serializers.CharField(source="context_course.display_coursenumber")
59 changes: 31 additions & 28 deletions cms/djangoapps/contentstore/rest_api/v1/views/certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,38 @@ def get(self, request: Request, course_id: str):
```json
{
"certificate_activation_handler_url": "/certificates/activation/course-v1:org+101+101/",
"certificate_web_view_url": "///certificates/course/course-v1:org+101+101?preview=honor",
"certificates": [
{
"course_title": "Course title",
"description": "Description of the certificate",
"editing": false,
"id": 1622146085,
"is_active": false,
"name": "Name of the certificate",
"signatories": [
"certificate_activation_handler_url": "/certificates/activation/course-v1:org+101+101/",
"certificate_web_view_url": "///certificates/course/course-v1:org+101+101?preview=honor",
"certificates": [
{
"id": 268550145,
"name": "name_sign",
"organization": "org",
"signature_image_path": "/asset-v1:org+101+101+type@[email protected]",
"title": "title_sign"
}
],
"version": 1
}
],
"course_modes": [
"honor"
],
"has_certificate_modes": true,
"is_active": false,
"is_global_staff": true,
"mfe_proctored_exam_settings_url": ""
"course_title": "Course title",
"description": "Description of the certificate",
"editing": false,
"id": 1622146085,
"is_active": false,
"name": "Name of the certificate",
"signatories": [
{
"id": 268550145,
"name": "name_sign",
"organization": "org",
"signature_image_path": "/asset-v1:org+101+101+type@[email protected]",
"title": "title_sign"
}
],
"version": 1
},
],
"course_modes": [
"honor"
],
"has_certificate_modes": true,
"is_active": false,
"is_global_staff": true,
"mfe_proctored_exam_settings_url": "",
"course_number": "DemoX",
"course_title": "Demonstration Course",
"course_number_override": "Course Number Display String"
}
```
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def test_success_response(self):
"""
self._add_course_certificates(count=2, signatory_count=2)
response = self.client.get(self.url)
response_data = response.data
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.data["certificates"]), 2)
self.assertEqual(len(response.data["certificates"][0]["signatories"]), 2)
self.assertEqual(len(response.data["certificates"][1]["signatories"]), 2)
self.assertEqual(len(response_data["certificates"]), 2)
self.assertEqual(len(response_data["certificates"][0]["signatories"]), 2)
self.assertEqual(len(response_data["certificates"][1]["signatories"]), 2)
self.assertEqual(response_data["course_number_override"], self.course.display_coursenumber)
self.assertEqual(response_data["course_title"], self.course.display_name_with_default)
self.assertEqual(response_data["course_number"], self.course.number)

0 comments on commit 36a49ec

Please sign in to comment.