From 3c656673c9800cb5b569d8f5209cfde14698db62 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 27 Nov 2024 12:54:15 -0500 Subject: [PATCH] fix: remove expired license status and define EnrollmentDueDateSerializer --- .../apps/api/v1/tests/test_bff_views.py | 4 ---- enterprise_access/apps/bffs/serializers.py | 14 ++++++++++++-- .../apps/bffs/tests/test_response_builders.py | 1 - 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/enterprise_access/apps/api/v1/tests/test_bff_views.py b/enterprise_access/apps/api/v1/tests/test_bff_views.py index 9402ecca..21036b31 100644 --- a/enterprise_access/apps/api/v1/tests/test_bff_views.py +++ b/enterprise_access/apps/api/v1/tests/test_bff_views.py @@ -141,7 +141,6 @@ def setUp(self): 'subscription_licenses_by_status': { 'activated': [], 'assigned': [], - 'expired': [], 'revoked': [], }, }, @@ -277,7 +276,6 @@ def test_dashboard_with_subscriptions( 'subscription_licenses_by_status': { 'activated': [self.expected_subscription_license], 'assigned': [], - 'expired': [], 'revoked': [], }, }, @@ -346,7 +344,6 @@ def test_dashboard_with_subscriptions_license_activation( 'subscription_licenses_by_status': { 'activated': [expected_activated_subscription_license], 'assigned': [], - 'expired': [], 'revoked': [], }, }, @@ -531,7 +528,6 @@ def test_dashboard_with_subscriptions_license_auto_apply( 'subscription_licenses_by_status': { 'activated': expected_licenses, 'assigned': [], - 'expired': [], 'revoked': [], }, }, diff --git a/enterprise_access/apps/bffs/serializers.py b/enterprise_access/apps/bffs/serializers.py index ff98ac85..b40a925c 100644 --- a/enterprise_access/apps/bffs/serializers.py +++ b/enterprise_access/apps/bffs/serializers.py @@ -222,7 +222,6 @@ class SubscriptionLicenseStatusSerializer(BaseBffSerializer): activated = SubscriptionLicenseSerializer(many=True, required=False, default=list) assigned = SubscriptionLicenseSerializer(many=True, required=False, default=list) - expired = SubscriptionLicenseSerializer(many=True, required=False, default=list) revoked = SubscriptionLicenseSerializer(many=True, required=False, default=list) @@ -252,6 +251,17 @@ class BaseLearnerPortalResponseSerializer(BaseResponseSerializer): enterprise_customer_user_subsidies = EnterpriseCustomerUserSubsidiesSerializer() + +class EnrollmentDueDateSerializer(BaseBffSerializer): + """ + Serializer for enrollment due date. + """ + + name = serializers.CharField() + date = serializers.CharField() + url = serializers.URLField() + + class EnterpriseCourseEnrollmentSerializer(BaseBffSerializer): """ Serializer for enterprise course enrollment. @@ -277,7 +287,7 @@ class EnterpriseCourseEnrollmentSerializer(BaseBffSerializer): resume_course_run_url = serializers.URLField(allow_null=True) is_revoked = serializers.BooleanField() due_dates = serializers.ListField( - child=serializers.DictField(), + child=EnrollmentDueDateSerializer(), allow_empty=True, ) diff --git a/enterprise_access/apps/bffs/tests/test_response_builders.py b/enterprise_access/apps/bffs/tests/test_response_builders.py index e5ec3d52..a61590d9 100644 --- a/enterprise_access/apps/bffs/tests/test_response_builders.py +++ b/enterprise_access/apps/bffs/tests/test_response_builders.py @@ -141,7 +141,6 @@ def test_build(self, mock_handler_context, has_subscriptions_data): "subscription_licenses_by_status": { 'activated': [], 'assigned': [], - 'expired': [], 'revoked': [], }, }