Merge pull request #25805 from edx/ddumesnil/aa-503
AA-503: Add id verification status into API
This commit is contained in:
@@ -112,6 +112,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
|
||||
course_exit_page_is_active = serializers.BooleanField()
|
||||
certificate_data = CertificateDataSerializer()
|
||||
verify_identity_url = AbsoluteURLField()
|
||||
verification_status = serializers.CharField()
|
||||
linkedin_add_to_profile_url = serializers.URLField()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -131,6 +131,7 @@ class CourseApiTestViews(BaseCoursewareTests):
|
||||
'The audit track does not include a certificate.')
|
||||
assert response.data['certificate_data']['msg'] == expected_audit_message
|
||||
assert response.data['verify_identity_url'] is None
|
||||
assert response.data['verification_status'] is 'none'
|
||||
assert response.data['linkedin_add_to_profile_url'] is None
|
||||
else:
|
||||
assert response.data['certificate_data']['cert_status'] == 'earned_but_not_available'
|
||||
@@ -139,6 +140,7 @@ class CourseApiTestViews(BaseCoursewareTests):
|
||||
)
|
||||
# The response contains an absolute URL so this is only checking the path of the final
|
||||
assert expected_verify_identity_url in response.data['verify_identity_url']
|
||||
assert response.data['verification_status'] is 'none'
|
||||
|
||||
request = RequestFactory().request()
|
||||
cert_url = get_certificate_url(course_id=self.course.id, uuid=cert.verify_uuid)
|
||||
|
||||
@@ -242,6 +242,17 @@ class CoursewareMeta:
|
||||
else:
|
||||
return IDVerificationService.get_verify_location(self.course_key)
|
||||
|
||||
@property
|
||||
def verification_status(self):
|
||||
"""
|
||||
Returns a String of the verification status of learner.
|
||||
"""
|
||||
if self.enrollment_object and self.enrollment_object.mode in CourseMode.VERIFIED_MODES:
|
||||
return IDVerificationService.user_status(self.effective_user)['status']
|
||||
# I know this looks weird (and is), but this is just so it is inline with what the
|
||||
# IDVerificationService.user_status method would return before a verification was created
|
||||
return 'none'
|
||||
|
||||
@property
|
||||
def linkedin_add_to_profile_url(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user