'has_item(BlockUsageLocator)'

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

    org = 'testx'
    course = 'GreekHero'
    run = 'run'
    course_locator = CourseLocator(org=org, course=course, run=run, branch=BRANCH_NAME_DRAFT)
    course = modulestore().get_course(course_locator)
    previous_version = course.previous_version
    locator = course.location.map_into_course(CourseLocator(version_guid=previous_version))
    self.assertTrue(modulestore().has_item(locator), ("couldn't    find    in    %s" % previous_version))
    locator = course.location.version_agnostic()
    self.assertTrue(modulestore().has_item(locator))
    self.assertFalse(modulestore().has_item(BlockUsageLocator(locator.course_key.for_branch(BRANCH_NAME_PUBLISHED), block_type=locator.block_type, block_id=locator.block_id)), 'found    in    published    head')
    locator = BlockUsageLocator(course_locator, block_type='chapter', block_id='chapter1')
    self.assertTrue(modulestore().has_item(locator), "couldn't    find    chapter1")
    locator = BlockUsageLocator(CourseLocator(org='testx', course='wonderful', run='run', branch=BRANCH_NAME_DRAFT), block_type='course', block_id='head23456')
    self.assertTrue(modulestore().has_item(locator.for_branch(BRANCH_NAME_PUBLISHED)))
