From 7fde730806efbf7ae73c74ab6797a20566c4ab47 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 31 Oct 2024 14:50:38 -0400 Subject: [PATCH] chore: fix tests for bulk enrollment with auto-enrollment --- enterprise/api/v1/serializers.py | 4 ++++ tests/test_enterprise/api/test_views.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/enterprise/api/v1/serializers.py b/enterprise/api/v1/serializers.py index d767cc398..219fbf978 100644 --- a/enterprise/api/v1/serializers.py +++ b/enterprise/api/v1/serializers.py @@ -1483,6 +1483,10 @@ class EnrollmentsInfoSerializer(serializers.Serializer): required=False, help_text='Enroll even if enrollment deadline is expired.', ) + is_default_auto_enrollment = serializers.BooleanField( + required=False, + help_text='Auto-enrollment for default enterprise enrollment intention.', + ) def create(self, validated_data): return validated_data diff --git a/tests/test_enterprise/api/test_views.py b/tests/test_enterprise/api/test_views.py index 02c90edaf..10074e34f 100644 --- a/tests/test_enterprise/api/test_views.py +++ b/tests/test_enterprise/api/test_views.py @@ -5911,7 +5911,7 @@ def test_enroll_learners_in_courses_partial_failure(self, mock_get_course_mode, ] }, 'fulfillment_source': LicensedEnterpriseCourseEnrollment, - 'expected_enrollment_realization_count': 0, + 'expected_enrollment_realization_count': 1, }, # Does NOT create DefaultEnterpriseEnrollmentRealization upon successful # subscription enrollment (is_default_auto_enrollment is False) @@ -6010,11 +6010,11 @@ def test_enroll_learners_in_courses_default_enrollment_realizations( enrollment = enrollments.first() assert enrollment.course_id == body['enrollments_info'][0]['course_run_key'] - enrollment_realization = DefaultEnterpriseEnrollmentRealization.objects.filter( + enrollment_realizations = DefaultEnterpriseEnrollmentRealization.objects.filter( intended_enrollment=enrollment_intention, realized_enrollment=enrollment, ) - assert len(enrollment_realization) == expected_enrollment_realization_count + assert len(enrollment_realizations) == expected_enrollment_realization_count @ddt.ddt