'Test a FileFinder flow with depth=5.'

def testDownloadDirectorySub(self):

    with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.OS, vfs_test_lib.ClientVFSHandlerFixture):
        client_mock = action_mocks.FileFinderClientMock()
        for _ in flow_test_lib.TestFlowHelper(file_finder.FileFinder.__name__, client_mock, client_id=self.client_id, paths=['/c/Downloads/**5'], action=rdf_file_finder.FileFinderAction(action_type=rdf_file_finder.FileFinderAction.Action.DOWNLOAD), token=self.token):
            pass
        output_path = self.client_id.Add('fs/os/c/Downloads')
        output_fd = aff4.FACTORY.Open(output_path, token=self.token)
        children = list(output_fd.OpenChildren())
        expected_children = u'a.txt    b.txt    c.txt    d.txt    sub1    \u4e2d\u56fd\u65b0\u95fb\u7f51\u65b0\u95fb\u4e2d.txt'
        self.assertEqual(len(children), 6)
        self.assertEqual(expected_children.split(), sorted([child.urn.Basename() for child in children]))
        for child in children:
            if (child.urn.Basename() == 'sub1'):
                break
        children = list(child.OpenChildren())
        expected_children = 'a.txt    b.txt    c.txt    d.txt'
        self.assertEqual(len(children), 4)
        self.assertEqual(expected_children.split(), sorted([child.urn.Basename() for child in children]))
