'Test that when we move an edited item from old parent to new parent and then discard changes in old parent,
item should be placed under original parent with initial state.'

@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_move_edited_revert(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
    problem = self.store.get_item(self.problem_x1a_1)
    orig_display_name = problem.display_name
    problem.display_name = 'updated'
    self.store.update_item(problem, self.user_id)
    updated_problem = self.store.get_item(self.problem_x1a_1)
    self.assertEqual(updated_problem.display_name, 'updated')
    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)
    reverted_problem = self.store.get_item(self.problem_x1a_1)
    self.assertEqual(orig_display_name, reverted_problem.display_name)
