def create_enrollment_and_history(self, user=None): """ Create ProgramEnrollment and several History entries """ if user: enrollment = ProgramEnrollmentFactory(user=user) else: enrollment = ProgramEnrollmentFactory() for status in ['pending', 'suspended', 'canceled', 'enrolled']: enrollment.status = status enrollment.save() return enrollment
def create_enrollment_and_history(self, user=None): """ Create ProgramEnrollment and several History entries """ if user: enrollment = ProgramEnrollmentFactory(user=user) else: enrollment = ProgramEnrollmentFactory() for status in ['pending', 'suspended', 'withdrawn', 'enrolled']: enrollment.status = status enrollment.save() return enrollment
def create_enrollment_and_history(self, user=None, external_user_key='defaultExternalKey'): """ Create ProgramEnrollment and several History entries """ if user: enrollment = ProgramEnrollmentFactory( user=user, external_user_key=external_user_key) else: enrollment = ProgramEnrollmentFactory( external_user_key=external_user_key) for status in ['pending', 'suspended', 'canceled', 'enrolled']: enrollment.status = status enrollment.save() return enrollment