diff --git a/lms/djangoapps/certificates/apis/v0/tests/test_views.py b/lms/djangoapps/certificates/apis/v0/tests/test_views.py index efff97f54d5a..c8ef620dd2db 100644 --- a/lms/djangoapps/certificates/apis/v0/tests/test_views.py +++ b/lms/djangoapps/certificates/apis/v0/tests/test_views.py @@ -173,17 +173,22 @@ def get_url(self, username): def assert_success_response_for_student(self, response, download_url='www.google.com'): """ This method is required by AuthAndScopesTestMixin. """ - assert response.data ==\ - [{'username': self.student.username, - 'course_id': str(self.course.id), - 'course_display_name': self.course.display_name, - 'course_organization': self.course.org, - 'certificate_type': CourseMode.VERIFIED, - 'created_date': self.now, - 'modified_date': self.now, - 'status': CertificateStatuses.downloadable, - 'is_passing': True, - 'download_url': download_url, 'grade': '0.88'}] + assert response.data == [ + { + 'username': self.student.username, + 'course_id': str(self.course.id), + 'course_display_name': self.course.display_name, + 'course_organization': self.course.org, + 'certificate_type': CourseMode.VERIFIED, + 'created_date': self.now, + 'modified_date': self.now, + 'status': CertificateStatuses.downloadable, + 'is_passing': True, + 'download_url': download_url, + 'grade': '0.88', + 'uuid': str(self.cert.verify_uuid) + } + ] @patch('edx_rest_framework_extensions.permissions.log') @ddt.data(*list(AuthType)) @@ -212,6 +217,7 @@ def test_another_user_with_certs_shared_public(self, auth_type): assert resp.status_code == status.HTTP_200_OK assert len(resp.data) == 1 + assert 'uuid' in resp.data[0] def test_owner_can_access_its_certs(self): """ @@ -227,6 +233,7 @@ def test_owner_can_access_its_certs(self): resp = self.get_response(AuthType.session, requesting_user=self.student) assert resp.status_code == status.HTTP_200_OK + assert 'uuid' in resp.data[0] # verifies that other than owner cert list api is not accessible resp = self.get_response(AuthType.session, requesting_user=self.other_student) @@ -246,12 +253,15 @@ def test_public_profile_certs_is_accessible(self): resp = self.get_response(AuthType.session, requesting_user=self.student) assert resp.status_code == status.HTTP_200_OK + assert 'uuid' in resp.data[0] resp = self.get_response(AuthType.session, requesting_user=self.other_student) assert resp.status_code == status.HTTP_200_OK + assert 'uuid' in resp.data[0] resp = self.get_response(AuthType.session, requesting_user=self.global_staff) assert resp.status_code == status.HTTP_200_OK + assert 'uuid' in resp.data[0] @ddt.data(*list(AuthType)) def test_another_user_with_certs_shared_custom(self, auth_type): @@ -276,6 +286,7 @@ def test_another_user_with_certs_shared_custom(self, auth_type): assert resp.status_code == status.HTTP_200_OK assert len(resp.data) == 1 + assert 'uuid' in resp.data[0] @patch('edx_rest_framework_extensions.permissions.log') @ddt.data(*JWT_AUTH_TYPES) @@ -290,6 +301,7 @@ def test_jwt_on_behalf_of_other_user(self, auth_type, mock_log): else: assert resp.status_code == status.HTTP_200_OK assert len(resp.data) == 1 + assert 'uuid' in resp.data[0] @patch('edx_rest_framework_extensions.permissions.log') @ddt.data(*JWT_AUTH_TYPES) @@ -422,3 +434,4 @@ def test_certificate_without_course(self, mock_get_course_run_details): assert response.status_code == status.HTTP_200_OK self.assertContains(response, cert_for_deleted_course.download_url) self.assertContains(response, expected_course_name) + assert 'uuid' in response.data[0]