def test_get_all_nodes_chunked_with_move_middle(self):
        """Test chunked get_all_nodes with a move in the middle."""
        root = self.vgw.get_root()
        root_id = root.id
        # make dirs and put files in them
        dirs = []
        files = []
        for i in range(10):
            d = self.vgw.make_subdirectory(root_id, '%sd' % i)
            f = self.vgw.make_file(d.id, '%sfile.txt' % i)
            dirs.append(d)
            files.append(f)
        nodes = dirs + files
        nodes.append(root)
        # sort them in the right order
        nodes.sort(key=attrgetter('path', 'name'))
        nodes_gen_19 = self.vgw.get_all_nodes(max_generation=19)
        self.assertEqual(nodes_gen_19, nodes[:20])

        # same but with the last generation
        nodes_limit_5 = self.vgw.get_all_nodes(max_generation=19, limit=5)
        self.assertEqual(nodes_limit_5, nodes[:5])
        last_node = nodes_limit_5[-1]
        nodes_limit_5 += self.vgw.get_all_nodes(
            start_from_path=(last_node.path, last_node.name),
            max_generation=19, limit=5)
        self.assertEqual(nodes_limit_5, nodes[:10])

        # move a node that's already in the result
        to_move = nodes[10:15][2]
        # now move a node that it's in the result,
        self.vgw.move_node(to_move.id, nodes[0].id, to_move.name)
        last_node = nodes_limit_5[-1]
        # get the rest of the result.
        nodes_limit_5 += self.vgw.get_all_nodes(
            start_from_path=(last_node.path, last_node.name),
            max_generation=19)
        # remove the moved node from the nodes_gen_19 list
        del nodes_gen_19[12]
        self.assertEqual(nodes_limit_5, nodes_gen_19)