From ad33eb3e7ce7956a9b110eb334454633cc50f03f Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 15 Jul 2024 16:13:24 +0500 Subject: [PATCH 1/3] fix: require subscription_uuid when enroll_all is provided regardless of its value --- license_manager/apps/api/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_manager/apps/api/serializers.py b/license_manager/apps/api/serializers.py index a100f8d3..c892b3b9 100644 --- a/license_manager/apps/api/serializers.py +++ b/license_manager/apps/api/serializers.py @@ -717,7 +717,7 @@ class Meta: ] def validate(self, attrs): - if attrs.get('enroll_all') and not attrs.get('subscription_uuid'): + if attrs.get('enroll_all') is not None and not attrs.get('subscription_uuid'): raise serializers.ValidationError({'subscription_id': 'This field is required when enroll_all is True.'}) return attrs From 343c45b6bc9048849bdd187dacf28699b425908d Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 15 Jul 2024 16:39:43 +0500 Subject: [PATCH 2/3] fix: allowed enroll_all value to be null --- license_manager/apps/api/serializers.py | 3 ++- license_manager/apps/api/v1/tests/test_views.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/license_manager/apps/api/serializers.py b/license_manager/apps/api/serializers.py index c892b3b9..20d7099f 100644 --- a/license_manager/apps/api/serializers.py +++ b/license_manager/apps/api/serializers.py @@ -702,6 +702,7 @@ class EnterpriseEnrollmentWithLicenseSubsidyQueryParamsSerializer(serializers.Se ) enroll_all = serializers.BooleanField( required=False, + allow_null=True, help_text='A boolean indicating whether to enroll all learners or not', ) subscription_uuid = serializers.UUIDField( @@ -718,7 +719,7 @@ class Meta: def validate(self, attrs): if attrs.get('enroll_all') is not None and not attrs.get('subscription_uuid'): - raise serializers.ValidationError({'subscription_id': 'This field is required when enroll_all is True.'}) + raise serializers.ValidationError({'subscription_id': 'This field is required when enroll_all is provided'}) return attrs diff --git a/license_manager/apps/api/v1/tests/test_views.py b/license_manager/apps/api/v1/tests/test_views.py index dc0458f2..9abea067 100644 --- a/license_manager/apps/api/v1/tests/test_views.py +++ b/license_manager/apps/api/v1/tests/test_views.py @@ -4096,7 +4096,7 @@ def test_bulk_licensed_enrollment_with_enroll_all_no_sub_uuid(self): url = self._get_url_with_params(enroll_all=True) response = self.api_client.post(url, data) assert response.status_code == 400 - expected_json = {'subscription_id': ['This field is required when enroll_all is True.']} + expected_json = {'subscription_id': ['This field is required when enroll_all is provided']} assert response.json() == expected_json def test_bulk_licensed_enrollment_with_missing_emails(self): From 6537c7a3a63f306ca7b6a602d13bc4d4490e22ce Mon Sep 17 00:00:00 2001 From: Hamzah Ullah Date: Mon, 15 Jul 2024 08:45:46 -0400 Subject: [PATCH 3/3] fix: updates max allowable batch size for link and notify (#679) --- license_manager/apps/subscriptions/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_manager/apps/subscriptions/constants.py b/license_manager/apps/subscriptions/constants.py index 05f2aa5c..70ffdef2 100644 --- a/license_manager/apps/subscriptions/constants.py +++ b/license_manager/apps/subscriptions/constants.py @@ -104,7 +104,7 @@ class SegmentEvents: # Bulk operation constants LICENSE_BULK_OPERATION_BATCH_SIZE = 100 -PENDING_ACCOUNT_CREATION_BATCH_SIZE = 100 +PENDING_ACCOUNT_CREATION_BATCH_SIZE = 50 LICENSE_SOURCE_BULK_OPERATION_BATCH_SIZE = 100 TRACK_LICENSE_CHANGES_BATCH_SIZE = 25 ASSIGNMENT_EMAIL_BATCH_SIZE = 50