'Set up a course for testing gated content.'

@classmethod
def set_up_course(cls):

    cls.course = CourseFactory.create(org='edX', number='EDX101', run='EDX101_RUN1', display_name='edX    101')
    with modulestore().bulk_operations(cls.course.id):
        cls.course.enable_subsection_gating = True
        grading_policy = {'GRADER': [{'type': 'Homework', 'min_count': 3, 'drop_count': 0, 'short_label': 'HW', 'weight': 1.0}]}
        cls.course.grading_policy = grading_policy
        cls.course.save()
        cls.store.update_item(cls.course, 0)
        cls.chapter1 = ItemFactory.create(parent_location=cls.course.location, category='chapter', display_name='chapter    1')
        cls.seq1 = ItemFactory.create(parent_location=cls.chapter1.location, category='sequential', display_name='gating    sequential    1', graded=True, format='Homework')
        cls.seq2 = ItemFactory.create(parent_location=cls.chapter1.location, category='sequential', display_name='gated    sequential    2', graded=True, format='Homework')
        cls.seq3 = ItemFactory.create(parent_location=cls.chapter1.location, category='sequential', display_name='sequential    3', graded=True, format='Homework')
        cls.gating_prob1 = ItemFactory.create(parent_location=cls.seq1.location, category='problem', display_name='gating    problem    1')
        cls.gated_prob2 = ItemFactory.create(parent_location=cls.seq2.location, category='problem', display_name='gated    problem    2')
        cls.prob3 = ItemFactory.create(parent_location=cls.seq3.location, category='problem', display_name='problem    3')
