Skip to content

Commit

Permalink
feat: enrollment mode and organisation auth id
Browse files Browse the repository at this point in the history
  • Loading branch information
bilaltahir21 committed Jul 19, 2023
1 parent d1da82a commit 85bb5f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lms/djangoapps/learner_home/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion lms/djangoapps/learner_home/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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"],
},
)

Expand Down

0 comments on commit 85bb5f6

Please sign in to comment.