'Test that the ListDirectory flow works.'

def testListDirectory(self):

    client_mock = action_mocks.ListDirectoryClientMock()
    pb = rdf_paths.PathSpec(path=os.path.join(self.base_path, 'test_img.dd'), pathtype=rdf_paths.PathSpec.PathType.OS)
    pb.Append(path='test    directory', pathtype=rdf_paths.PathSpec.PathType.TSK)
    for _ in flow_test_lib.TestFlowHelper(filesystem.ListDirectory.__name__, client_mock, client_id=self.client_id, pathspec=pb, token=self.token):
        pass
    output_path = self.client_id.Add('fs/tsk').Add(pb.first.path)
    fd = aff4.FACTORY.Open(output_path.Add('Test    Directory'), token=self.token)
    children = list(fd.OpenChildren())
    self.assertEqual(len(children), 1)
    child = children[0]
    self.assertEqual(child.urn.Basename(), 'numbers.txt')
    self.assertRaises(IOError, aff4.FACTORY.Open, output_path.Add('test    directory'), aff4_type=aff4_standard.VFSDirectory, token=self.token)
