From 85bb5f60d7bd9213c25290d4763062c71686893f Mon Sep 17 00:00:00 2001 From: Muhammad Bilal Tahir <106396899+bilaltahir21@users.noreply.github.com> Date: Tue, 18 Jul 2023 19:30:48 +0500 Subject: [PATCH] feat: enrollment mode and organisation auth id --- lms/djangoapps/learner_home/serializers.py | 3 +++ lms/djangoapps/learner_home/test_serializers.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/learner_home/serializers.py b/lms/djangoapps/learner_home/serializers.py index b0c16fc3f513..3cb5dabd6e84 100644 --- a/lms/djangoapps/learner_home/serializers.py +++ b/lms/djangoapps/learner_home/serializers.py @@ -200,6 +200,7 @@ class EnrollmentSerializer(serializers.Serializer): hasOptedOutOfEmail = serializers.SerializerMethodField() lastEnrolled = serializers.DateTimeField(source="created") isEnrolled = serializers.BooleanField(source="is_active") + mode = serializers.CharField() def get_accessExpirationDate(self, instance): return self.context.get("audit_access_deadlines", {}).get(instance.course_id) @@ -495,6 +496,7 @@ class UnfulfilledEntitlementSerializer(serializers.Serializer): "hasOptedOutOfEmail": False, "lastEnrolled": None, "isEnrolled": False, + "mode": None, } # These fields contain all real data and will be serialized @@ -561,6 +563,7 @@ class EnterpriseDashboardSerializer(serializers.Serializer): label = serializers.CharField(source="name") url = serializers.SerializerMethodField() uuid = serializers.UUIDField() + authOrgId = serializers.CharField(source="auth_org_id") isLearnerPortalEnabled = serializers.BooleanField(source="enable_learner_portal") def get_url(self, instance): diff --git a/lms/djangoapps/learner_home/test_serializers.py b/lms/djangoapps/learner_home/test_serializers.py index 41990eed896e..6e53c3a6ab60 100644 --- a/lms/djangoapps/learner_home/test_serializers.py +++ b/lms/djangoapps/learner_home/test_serializers.py @@ -1132,6 +1132,7 @@ def generate_test_enterprise_customer(cls): "slug": str(uuid4()), "enable_learner_portal": True, "uuid": str(uuid4()), + "auth_org_id": str(uuid4()), } def test_structure(self): @@ -1140,7 +1141,7 @@ def test_structure(self): output_data = EnterpriseDashboardSerializer(input_data).data - expected_keys = ["label", "url", "uuid", "isLearnerPortalEnabled"] + expected_keys = ["label", "url", "uuid", "isLearnerPortalEnabled", "authOrgId"] self.assertEqual(output_data.keys(), set(expected_keys)) def test_happy_path(self): @@ -1159,6 +1160,7 @@ def test_happy_path(self): + input_data["slug"], "uuid": input_data["uuid"], "isLearnerPortalEnabled": input_data["enable_learner_portal"], + "authOrgId": input_data["auth_org_id"], }, )