'Set up courses and enrollments.'

def setUp(self):

    super(TestStudentViewsWithCCX, self).setUp()
    self.student_password = 'foobar'
    self.student = UserFactory.create(username='test', password=self.student_password, is_staff=False)
    self.draft_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.mongo)
    self.split_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.split)
    CourseEnrollment.enroll(self.student, self.draft_course.id)
    CourseEnrollment.enroll(self.student, self.split_course.id)
    self.coach = AdminFactory.create()
    role = CourseCcxCoachRole(self.split_course.id)
    role.add_users(self.coach)
    self.ccx = CcxFactory(course_id=self.split_course.id, coach=self.coach)
    last_week = (datetime.datetime.now(UTC()) - datetime.timedelta(days=7))
    override_field_for_ccx(self.ccx, self.split_course, 'start', last_week)
    self.ccx_course_key = CCXLocator.from_course_locator(self.split_course.id, self.ccx.id)
    CourseEnrollment.enroll(self.student, self.ccx_course_key)
