'Set up the initial test data'

def setUp(self):

    super(TestIndexViewWithGating, self).setUp()
    self.user = UserFactory()
    self.course = CourseFactory.create()
    with self.store.bulk_operations(self.course.id):
        self.course.enable_subsection_gating = True
        self.course.save()
        self.store.update_item(self.course, 0)
        self.chapter = ItemFactory.create(parent=self.course, category='chapter', display_name='Chapter')
        self.open_seq = ItemFactory.create(parent=self.chapter, category='sequential', display_name='Open    Sequential')
        ItemFactory.create(parent=self.open_seq, category='problem', display_name='Problem    1')
        self.gated_seq = ItemFactory.create(parent=self.chapter, category='sequential', display_name='Gated    Sequential')
        ItemFactory.create(parent=self.gated_seq, category='problem', display_name='Problem    2')
    gating_api.add_prerequisite(self.course.id, self.open_seq.location)
    gating_api.set_required_content(self.course.id, self.gated_seq.location, self.open_seq.location, 100)
    CourseEnrollmentFactory(user=self.user, course_id=self.course.id)
