'Test the versions pointers. NOTE: you can change the org, course, or other things, but
it\'s not clear how you\'d find them again or associate them w/ existing student history since
we use course_key so many places as immutable.'

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

    locator = CourseLocator(org='testx', course='GreekHero', run='run', branch=BRANCH_NAME_DRAFT)
    course_info = modulestore().get_course_index_info(locator)
    head_course = modulestore().get_course(locator)
    versions = course_info['versions']
    versions[BRANCH_NAME_DRAFT] = head_course.previous_version
    modulestore().update_course_index(None, course_info)
    course = modulestore().get_course(locator)
    self.assertEqual(course.location.version_guid, versions[BRANCH_NAME_DRAFT])
    versions[BRANCH_NAME_PUBLISHED] = versions[BRANCH_NAME_DRAFT]
    modulestore().update_course_index(None, course_info)
    course = modulestore().get_course(locator.for_branch(BRANCH_NAME_PUBLISHED))
    self.assertEqual(course.location.version_guid, versions[BRANCH_NAME_DRAFT])
