'Verifies that item is placed under expected parent.
Arguments:
item_location (BlockUsageLocator)    : Locator of item.
expected_parent_location (BlockUsageLocator)  : Expected parent block locator.
old_parent_location (BlockUsageLocator)  : Old parent block locator.
is_reverted (Boolean)   : A flag to notify that item was reverted.'

def verify_item_parent(self, item_location, expected_parent_location, old_parent_location, is_reverted=False):

    with self.store.bulk_operations(self.course.id):
        source_item = self.store.get_item(item_location)
        old_parent = self.store.get_item(old_parent_location)
        expected_parent = self.store.get_item(expected_parent_location)
        self.assertEqual(expected_parent_location, source_item.get_parent().location)
        published_parent_location = (expected_parent_location if is_reverted else old_parent_location)
        with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred):
            self.assertEqual(expected_parent_location, self.store.get_item(item_location).get_parent().location)
        with self.store.branch_setting(ModuleStoreEnum.Branch.published_only):
            self.assertEqual(published_parent_location, self.store.get_item(item_location).get_parent().location)
        published_parent_location = published_parent_location.for_branch(ModuleStoreEnum.BranchName.published)
        self.verify_get_parent_locations_results([(item_location, expected_parent_location, None), (item_location, expected_parent_location, ModuleStoreEnum.RevisionOption.draft_preferred), (item_location, published_parent_location, ModuleStoreEnum.RevisionOption.published_only)])
        self.assertEqual(source_item.parent, expected_parent_location)
        self.assertEqual(source_item.parent, self.store.get_parent_location(item_location))
        self.assertIn(item_location, expected_parent.children)
        self.assertNotIn(item_location, old_parent.children)
