def make_cs101_course(teacher=None, discipline=None, students=None): course = make_page( 'courses.Course', root='course-list', title='Programming 101', slug='cs101', teacher=teacher or make_yoda_teacher(), discipline=discipline or make_cs101_discipline(), activities_template='programming-beginner', ) students = make_students(5) if students is None else students for student in students: course.enroll_student(student) return course
def fill_courses_with_users(): from codeschool.lms.courses.models import Course from codeschool.accounts.factories import make_teachers, make_joe_user, \ make_mr_robot if not global_data_store.get('courses-populated', False): user = models.User.objects.get(id=global_data_store['admin-user-id']) global_data_store['courses-populated'] = True teachers = [user] teachers.extend(make_teachers()) common = [make_mr_robot(), make_joe_user()] for teacher, course in zip(teachers, Course.objects.all()): from codeschool.accounts.factories import make_students for student in list(make_students(3)) + common: course.enroll_student(student) course.teacher = teacher course.save()
def test_create_students(db): students = make_students(5)