'Tests iterated listing of directories.'

def testIteratedListDirectory(self):

    p = rdf_paths.PathSpec(path=self.base_path, pathtype=rdf_paths.PathSpec.PathType.OS)
    non_iterated_results = self.RunAction(standard.ListDirectory, rdf_client.ListDirRequest(pathspec=p))
    l = len(non_iterated_results)
    self.assertTrue((l > 0))
    iterated_results = []
    request = rdf_client.ListDirRequest(pathspec=p)
    request.iterator.number = 2
    while True:
        responses = self.RunAction(standard.IteratedListDirectory, request)
        results = responses[:(-1)]
        if (not results):
            break
        for result in results:
            iterated_results.append(result)
    for (x, y) in zip(non_iterated_results, iterated_results):
        x.st_atime = y.st_atime = 0
        self.assertRDFValuesEqual(x, y)
