'Set up a course with graded problems within a split test.
Course hierarchy is as follows (modeled after how split tests
are created in studio):
-> course
-> chapter
-> sequential (graded)
-> vertical
-> split_test
-> vertical (Group A)
-> problem
-> vertical (Group B)
-> problem'

def setUp(self):

    super(TestConditionalContent, self).setUp()
    self.user_partition_group_a = 0
    self.user_partition_group_b = 1
    self.partition = UserPartition(0, 'first_partition', 'First    Partition', [Group(self.user_partition_group_a, 'Group    A'), Group(self.user_partition_group_b, 'Group    B')])
    self.course = CourseFactory.create(user_partitions=[self.partition], grading_policy={'GRADER': [{'type': 'Homework', 'min_count': 1, 'drop_count': 0, 'short_label': 'HW', 'weight': 1.0}]})
    chapter = ItemFactory.create(parent_location=self.course.location, display_name='Chapter')
    self.problem_section = ItemFactory.create(parent_location=chapter.location, category='sequential', metadata={'graded': True, 'format': 'Homework'}, display_name=self.TEST_SECTION_NAME)
    self.student_a = UserFactory.create(username='student_a', email='student_a@example.com')
    CourseEnrollmentFactory.create(user=self.student_a, course_id=self.course.id)
    self.student_b = UserFactory.create(username='student_b', email='student_b@example.com')
    CourseEnrollmentFactory.create(user=self.student_b, course_id=self.course.id)
    UserCourseTagFactory(user=self.student_a, course_id=self.course.id, key='xblock.partition_service.partition_{0}'.format(self.partition.id), value=str(self.user_partition_group_a))
    UserCourseTagFactory(user=self.student_b, course_id=self.course.id, key='xblock.partition_service.partition_{0}'.format(self.partition.id), value=str(self.user_partition_group_b))
    problem_vertical = ItemFactory.create(parent_location=self.problem_section.location, category='vertical', display_name='Problem    Unit')
    vertical_a_url = self.course.id.make_usage_key('vertical', 'split_test_vertical_a')
    vertical_b_url = self.course.id.make_usage_key('vertical', 'split_test_vertical_b')
    self.split_test = ItemFactory.create(parent_location=problem_vertical.location, category='split_test', display_name='Split    Test', user_partition_id=self.partition.id, group_id_to_child={str(index): url for (index, url) in enumerate([vertical_a_url, vertical_b_url])})
    self.vertical_a = ItemFactory.create(parent_location=self.split_test.location, category='vertical', display_name='Group    A    problem    container', location=vertical_a_url)
    self.vertical_b = ItemFactory.create(parent_location=self.split_test.location, category='vertical', display_name='Group    B    problem    container', location=vertical_b_url)
