@chrisndodge The method that I found was change_enrollment in common/djangoapps/student/views.py. The only line of interest in this method was CourseEnrollment.objects.get_or_create(user=user, course_id=course.id). Therefore I decided to call that directly instead of trying to create a fake request to call the views.py method. Do you have another suggestion? I could create a helper method in views.py (or someplace else if there is a better place) to hide this line of code.