history on bulk create of enrollments (#23389)
fixes bug where bulk creation of enrollments caused no new history records to be created
This commit is contained in:
@@ -55,19 +55,23 @@ class WritingProgramEnrollmentTest(CacheIsolationTestCase):
|
||||
|
||||
def test_write_program_enrollments_status_ended(self):
|
||||
"""
|
||||
Successfully updates program enrollment to status ended if requested
|
||||
Successfully updates program enrollment to status ended if requested.
|
||||
This also validates history records are created on both create and update.
|
||||
"""
|
||||
assert ProgramEnrollment.objects.count() == 0
|
||||
assert ProgramEnrollment.historical_records.count() == 0 # pylint: disable=no-member
|
||||
write_program_enrollments(self.program_uuid_x, [{
|
||||
'external_user_key': self.user_0,
|
||||
'status': PEStatuses.PENDING,
|
||||
'curriculum_uuid': self.curriculum_uuid_a,
|
||||
}], True, False)
|
||||
assert ProgramEnrollment.objects.count() == 1
|
||||
assert ProgramEnrollment.historical_records.count() == 1 # pylint: disable=no-member
|
||||
write_program_enrollments(self.program_uuid_x, [{
|
||||
'external_user_key': self.user_0,
|
||||
'status': PEStatuses.ENDED,
|
||||
'curriculum_uuid': self.curriculum_uuid_a,
|
||||
}], False, True)
|
||||
assert ProgramEnrollment.objects.count() == 1
|
||||
assert ProgramEnrollment.historical_records.count() == 2 # pylint: disable=no-member
|
||||
assert ProgramEnrollment.objects.filter(status=PEStatuses.ENDED).exists()
|
||||
|
||||
Reference in New Issue
Block a user