'Test that when we move an item to new parent and discard changes for the old parent, then the item should be
present in the old parent and then moving an item from old parent to new parent should place that item under
new parent.'

@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_move_revert_move(self, store_type):

    self.initdb(store_type)
    self._create_block_hierarchy()
    self.course = self.store.publish(self.course.location, self.user_id)
    item_location = self.problem_x1a_1
    new_parent_location = self.vertical_y1a
    old_parent_location = self.vertical_x1a
    updated_item_location = self.store.update_item_parent(item_location, new_parent_location, old_parent_location, self.user_id)
    self.assertEqual(updated_item_location, item_location)
    self.verify_item_parent(item_location=item_location, expected_parent_location=new_parent_location, old_parent_location=old_parent_location)
    self.store.revert_to_published(old_parent_location, self.user_id)
    self.verify_item_parent(item_location=item_location, expected_parent_location=old_parent_location, old_parent_location=new_parent_location, is_reverted=True)
    updated_item_location = self.store.update_item_parent(item_location, new_parent_location, old_parent_location, self.user_id)
    self.assertEqual(updated_item_location, item_location)
    self.verify_item_parent(item_location=item_location, expected_parent_location=new_parent_location, old_parent_location=old_parent_location)
