def testIteratedDirectoryListing(self):
    with test_lib.VFSOverrider(
        rdf_paths.PathSpec.PathType.OS, MockVFSHandler):
      path = "/"
      # Run the flow in the simulated way
      client_mock = action_mocks.ActionMock("IteratedListDirectory")
      for _ in test_lib.TestFlowHelper(
          "IteratedListDirectory", client_mock, client_id=self.client_id,
          pathspec=rdf_paths.PathSpec(path="/",
                                      pathtype=rdf_paths.PathSpec.PathType.OS),
          token=self.token):
        pass

      fd = aff4.FACTORY.Open(self.client_id.Add("fs/os").Add(path),
                             token=self.token)
      directory = [ch for ch in fd.OpenChildren()]
      pb = rdf_paths.PathSpec(path=path,
                              pathtype=rdf_paths.PathSpec.PathType.OS)
      directory2 = list(vfs.VFSOpen(pb).ListFiles())
      directory.sort()
      result = [x.Get(x.Schema.STAT) for x in directory]

      # Make sure that the resulting directory is what it should be
      for x, y in zip(result, directory2):
        x.aff4path = None

        self.assertEqual(x.st_mode, y.st_mode)
        self.assertRDFValuesEqual(x, y)
Test that the client iterator works.
dataset/ETHPy150Open google/grr/grr/lib/flow_test.py/GeneralFlowsTest.testIteratedDirectoryListing