'Test that "get_parent_location" method returns first published parent
for a draft component, if it has many possible parents (including
draft parents).'

@ddt.data(ModuleStoreEnum.Type.mongo)
def test_get_parent_location_draft(self, default_ms):

    self.initdb(default_ms)
    course_id = self.course_locations[self.MONGO_COURSEID].course_key
    self._create_block_hierarchy()
    self.store.publish(self.course.location, self.user_id)
    mongo_store = self.store._get_modulestore_for_courselike(course_id)
    mongo_store.collection.update(self.vertical_x1b.to_deprecated_son('_id.'), {'$push': {'definition.children': unicode(self.problem_x1a_1)}})
    self.store.convert_to_draft(self.vertical_x1a, self.user_id)
    item = self.store.get_item(self.vertical_x1a)
    self.assertTrue(self.store.has_published_version(item))
    with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, course_id):
        parent = mongo_store.get_parent_location(self.problem_x1a_1)
        self.assertEqual(parent, self.vertical_x1a)
