예제 #1
0
    def testRendersRequestedCronJobApproval(self):
        cron_manager = aff4_cronjobs.CronManager()
        cron_args = aff4_cronjobs.CreateCronJobFlowArgs(periodicity="1d",
                                                        allow_overruns=False)
        cron_job_urn = cron_manager.ScheduleFlow(cron_args=cron_args,
                                                 token=self.token)

        self.RequestCronJobApproval(cron_job_urn.Basename(),
                                    reason=self.token.reason,
                                    approver="approver",
                                    requestor=self.token.username)

        args = user_plugin.ApiListCronJobApprovalsArgs()
        result = self.handler.Handle(args, token=self.token)

        self.assertEqual(len(result.items), 1)
예제 #2
0
 def ListCronJobApprovals(self, requestor=None):
     requestor = requestor or self.token.username
     handler = api_user.ApiListCronJobApprovalsHandler()
     return handler.Handle(
         api_user.ApiListCronJobApprovalsArgs(),
         token=access_control.ACLToken(username=requestor)).items