'Test that when we move an item inside an old parent having multiple items, we delete one item and move
other item from old to new parent, then discard changes in old parent would undo delete the deleted
item and move back the moved item to old location.'

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

    self.initdb(store_type)
    self._create_block_hierarchy()
    problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2')
    orig_display_name = problem_item2.display_name
    self.course = self.store.publish(self.course.location, self.user_id)
    self.store.delete_item(problem_item2.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)
    problem_item2 = self.store.get_item(problem_item2.location)
    self.assertEqual(problem_item2.parent, self.vertical_x1a)
    self.assertIn(problem_item2.location, problem_item2.get_parent().children)
