diff --git a/enterprise/api/v1/serializers.py b/enterprise/api/v1/serializers.py index 22ea4a5c00..008910f094 100644 --- a/enterprise/api/v1/serializers.py +++ b/enterprise/api/v1/serializers.py @@ -349,7 +349,7 @@ class EnterpriseCourseEnrollmentReadOnlySerializer(serializers.ModelSerializer): class Meta: model = models.EnterpriseCourseEnrollment fields = ( - 'enterprise_customer_user', 'course_id' + 'enterprise_customer_user', 'course_id', 'modified', ) @@ -417,7 +417,7 @@ class LearnerCreditEnterpriseCourseEnrollmentReadOnlySerializer(serializers.Mode class Meta: model = models.LearnerCreditEnterpriseCourseEnrollment fields = ( - 'enterprise_course_enrollment', 'transaction_id' + 'enterprise_course_enrollment', 'transaction_id', 'uuid', ) @@ -431,7 +431,7 @@ class LicensedEnterpriseCourseEnrollmentReadOnlySerializer(serializers.ModelSeri class Meta: model = models.LicensedEnterpriseCourseEnrollment fields = ( - 'enterprise_course_enrollment', 'license_uuid' + 'enterprise_course_enrollment', 'license_uuid', 'uuid', ) diff --git a/enterprise/api/v1/views.py b/enterprise/api/v1/views.py index 757ae741db..31907577da 100644 --- a/enterprise/api/v1/views.py +++ b/enterprise/api/v1/views.py @@ -278,7 +278,7 @@ def enroll_learners_in_courses(self, request, pk): """ Creates a set of enterprise enrollments for specified learners by bulk enrolling them in provided courses. This endpoint is not transactional, in that any one or more failures will not affect other successful - enrollments smade within the same request. + enrollments made within the same request. Parameters: enrollments_info (list of dicts): an array of dictionaries, each containing the necessary information to diff --git a/tests/test_enterprise/api/test_views.py b/tests/test_enterprise/api/test_views.py index 8d208699a0..87962d6112 100644 --- a/tests/test_enterprise/api/test_views.py +++ b/tests/test_enterprise/api/test_views.py @@ -1232,10 +1232,12 @@ class TestEnterpriseCustomerViewSet(BaseTestEnterpriseAPIViews): [{ 'enterprise_customer_user__id': 1, 'course_id': 'course-v1:edX+DemoX+DemoCourse', + 'modified': '2021-10-20T19:01:31Z', }], [{ 'enterprise_customer_user': 1, 'course_id': 'course-v1:edX+DemoX+DemoCourse', + 'modified': '2021-10-20T19:01:31Z', }], ), ( @@ -3399,18 +3401,24 @@ def test_requested_recently_unenrolled_subsidy_fulfillment(self): OrderedDict([ ('enterprise_course_enrollment', OrderedDict([ ('enterprise_customer_user', lc_ent_user_1), - ('course_id', self.learner_credit_course_enrollment.enterprise_course_enrollment.course_id) + ('course_id', self.learner_credit_course_enrollment.enterprise_course_enrollment.course_id), + ('modified', self.learner_credit_course_enrollment.modified.strftime("%Y-%m-%dT%H:%M:%SZ")), ])), - ('transaction_id', self.learner_credit_course_enrollment.transaction_id) + ('transaction_id', self.learner_credit_course_enrollment.transaction_id), + ('uuid', str(self.learner_credit_course_enrollment.uuid)), ]), OrderedDict([ ('enterprise_course_enrollment', OrderedDict( [ ('enterprise_customer_user', lc_ent_user_2), - ('course_id', second_lc_enrollment.enterprise_course_enrollment.course_id) + ('course_id', second_lc_enrollment.enterprise_course_enrollment.course_id), + ('modified', second_lc_enrollment.enterprise_course_enrollment.modified.strftime( + "%Y-%m-%dT%H:%M:%SZ" + )), ] )), - ('transaction_id', second_lc_enrollment.transaction_id) + ('transaction_id', second_lc_enrollment.transaction_id), + ('uuid', str(second_lc_enrollment.uuid)), ]) ] @@ -3440,14 +3448,17 @@ def test_recently_unenrolled_fulfillment_endpoint_can_filter_for_modified_after( ) ent_user = old_learner_credit_enrollment.enterprise_course_enrollment.enterprise_customer_user.id - assert response.data == [ OrderedDict([ ('enterprise_course_enrollment', OrderedDict([ ('enterprise_customer_user', ent_user), - ('course_id', old_learner_credit_enrollment.enterprise_course_enrollment.course_id) + ('course_id', old_learner_credit_enrollment.enterprise_course_enrollment.course_id), + ('modified', old_learner_credit_enrollment.enterprise_course_enrollment.modified.strftime( + "%Y-%m-%dT%H:%M:%SZ" + )), ])), - ('transaction_id', old_learner_credit_enrollment.transaction_id) + ('transaction_id', old_learner_credit_enrollment.transaction_id), + ('uuid', str(old_learner_credit_enrollment.uuid)), ]), ] @@ -3466,9 +3477,13 @@ def test_recently_unenrolled_licensed_fulfillment_object(self): OrderedDict([ ('enterprise_course_enrollment', OrderedDict([ ('enterprise_customer_user', ent_user), - ('course_id', self.licensed_course_enrollment.enterprise_course_enrollment.course_id) + ('course_id', self.licensed_course_enrollment.enterprise_course_enrollment.course_id), + ('modified', self.licensed_course_enrollment.enterprise_course_enrollment.modified.strftime( + "%Y-%m-%dT%H:%M:%SZ" + )), ])), - ('license_uuid', str(self.licensed_course_enrollment.license_uuid)) + ('license_uuid', str(self.licensed_course_enrollment.license_uuid)), + ('uuid', str(self.licensed_course_enrollment.uuid)), ]), ] @@ -3486,7 +3501,9 @@ def test_successful_retrieve_licensed_enrollment(self): 'enterprise_course_enrollment': { 'enterprise_customer_user': self.enterprise_user.id, 'course_id': self.enterprise_course_enrollment.course_id, - } + 'modified': self.enterprise_course_enrollment.modified.strftime("%Y-%m-%dT%H:%M:%SZ"), + }, + 'uuid': str(self.licensed_course_enrollment.uuid), } def test_successful_retrieve_learner_credit_enrollment(self): @@ -3504,7 +3521,9 @@ def test_successful_retrieve_learner_credit_enrollment(self): 'enterprise_course_enrollment': { 'enterprise_customer_user': self.enterprise_user.id, 'course_id': self.enterprise_course_enrollment.course_id, - } + 'modified': self.enterprise_course_enrollment.modified.strftime("%Y-%m-%dT%H:%M:%SZ"), + }, + 'uuid': str(self.learner_credit_course_enrollment.uuid), } def test_retrieve_nonexistent_enrollment(self):