'get_parent_location(locator): BlockUsageLocator'

def test_get_parents(self):

    locator = BlockUsageLocator(CourseLocator(org='testx', course='GreekHero', run='run', branch=BRANCH_NAME_DRAFT), 'chapter', block_id='chapter1')
    parent = modulestore().get_parent_location(locator)
    self.assertIsNotNone(parent)
    self.assertEqual(parent.block_id, 'head12345')
    self.assertEqual(parent.org, 'testx')
    self.assertEqual(parent.course, 'GreekHero')
    locator = locator.course_key.make_usage_key('chapter', 'chapter2')
    parent = modulestore().get_parent_location(locator)
    self.assertIsNotNone(parent)
    self.assertEqual(parent.block_id, 'head12345')
    locator = locator.course_key.make_usage_key('garbage', 'nosuchblock')
    parent = modulestore().get_parent_location(locator)
    self.assertIsNone(parent)
