From 507b868e654b4e72b3d903acb22665d6b2d1d509 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 20 Nov 2024 15:37:47 -0500 Subject: [PATCH 1/2] fix: use LearnerLicenseSerializer in LicenseActivationView --- license_manager/apps/api/v1/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_manager/apps/api/v1/views.py b/license_manager/apps/api/v1/views.py index 5757b862..7d4579f2 100644 --- a/license_manager/apps/api/v1/views.py +++ b/license_manager/apps/api/v1/views.py @@ -1801,7 +1801,7 @@ def post(self, request): # There's an implied logical branch where the license is already activated # in which case we also return as if the activation action was successful. - serialized_license = serializers.LicenseSerializer(user_license) + serialized_license = serializers.LearnerLicenseSerializer(user_license) return Response(serialized_license.data, status=status.HTTP_200_OK) def _track_and_notify(self, user_license): From 4cfa74cf568f7a621a966f26d9bcb9f43cac8918 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 20 Nov 2024 15:55:22 -0500 Subject: [PATCH 2/2] chore: test --- .../apps/api/v1/tests/test_license_activation_view.py | 1 + 1 file changed, 1 insertion(+) diff --git a/license_manager/apps/api/v1/tests/test_license_activation_view.py b/license_manager/apps/api/v1/tests/test_license_activation_view.py index 7adf1f76..0377e7a8 100644 --- a/license_manager/apps/api/v1/tests/test_license_activation_view.py +++ b/license_manager/apps/api/v1/tests/test_license_activation_view.py @@ -152,6 +152,7 @@ def test_activate_an_assigned_license(self, mock_send_post_activation_email_task assert activated_license['status'] == constants.ACTIVATED expected_activation_date = self.now.strftime('%Y-%m-%dT%H:%M:%S.%fZ') assert activated_license['activation_date'] == expected_activation_date + assert activated_license['subscription_plan']['uuid'] == str(license_to_be_activated.subscription_plan.uuid) # Refresh license from the database license_to_be_activated.refresh_from_db()