def test_get_all_nodes_with_limit(self):
        """Test get_all_nodes with a limit."""
        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'))

        # get the nodes by chunks of 10 top
        nodes_limit_10 = self.vgw.get_all_nodes(limit=10)
        self.assertEqual(nodes_limit_10, nodes[:10])
        last_node = nodes_limit_10[-1]
        nodes_limit_10 += self.vgw.get_all_nodes(
            start_from_path=(last_node.path, last_node.name),
            limit=10)
        self.assertEqual(nodes_limit_10, nodes[:20])
        last_node = nodes_limit_10[-1]
        nodes_limit_10 += self.vgw.get_all_nodes(
            start_from_path=(last_node.path, last_node.name),
            limit=10)
        self.assertEqual(nodes_limit_10, nodes)