'Testing initialization of a ConfigManager.'

def testCronJobPreservesFlowNameAndArguments(self):

    pathspec = rdf_paths.PathSpec(path='/foo', pathtype=rdf_paths.PathSpec.PathType.TSK)
    cron_manager = cronjobs.CronManager()
    cron_args = cronjobs.CreateCronJobFlowArgs(periodicity='1d', allow_overruns=False)
    cron_args.flow_runner_args.flow_name = transfer.GetFile.__name__
    cron_args.flow_args.pathspec = pathspec
    cron_job_urn = cron_manager.ScheduleFlow(cron_args=cron_args, token=self.token)
    cron_root = aff4.FACTORY.Open(cron_manager.CRON_JOBS_PATH, token=self.token)
    cron_jobs = list(cron_root.ListChildren())
    self.assertEqual(len(cron_jobs), 1)
    self.assertEqual(cron_jobs[0], cron_job_urn)
    cron_job = aff4.FACTORY.Open(cron_jobs[0], token=self.token)
    cron_args = cron_job.Get(cron_job.Schema.CRON_ARGS)
    self.assertEqual(cron_args.flow_runner_args.flow_name, transfer.GetFile.__name__)
    self.assertEqual(cron_args.flow_args.pathspec, pathspec)
    self.assertEqual(cron_args.periodicity, rdfvalue.Duration('1d'))
    self.assertEqual(cron_args.allow_overruns, False)
