'Test that if two courses point to same course index,
`get_courses` should return both courses.'

@patch('xmodule.tabs.CourseTab.from_json', side_effect=mock_tab_from_json)
def test_get_courses_with_same_course_index(self, _from_json):

    courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT)
    self.assertEqual(len(courses), 3)
    course_index = modulestore().get_course_index_info(courses[0].id)
    new_draft_course = modulestore().create_course('testX', 'rerun_2.0', 'run_q2', 1, BRANCH_NAME_DRAFT, versions_dict=course_index['versions'])
    courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT)
    self.assertEqual(len(courses), 4)
    self.assertIn(new_draft_course.id.version_agnostic(), [c.id for c in courses])
