def render_POST(self, request): run_time = requestargs.get_datetime(request, 'run_time') return handle_command( request, self.controller, self.job_scheduler, run_time=run_time)
def render_POST(self, request): run_time = requestargs.get_datetime(request, 'run_time') return handle_command( request, self.controller, self.job_scheduler, run_time=run_time, )
def render_POST(self, request): cmd = requestargs.get_string(request, "command") log.info("Handling '%s' request for job run %s", cmd, self._job_sched.job.name) if cmd == "enable": self._job_sched.enable() msg = "Job %s is enabled" % self._job_sched.job.name elif cmd == "disable": self._job_sched.disable() msg = "Job %s is disabled" % self._job_sched.job.name elif cmd == "start": run_time = requestargs.get_datetime(request, "run_time") runs = self._job_sched.manual_start(run_time=run_time) msg = "New Job Runs %s created" % ",".join([r.id for r in runs]) else: return respond(request, None, code=http.NOT_IMPLEMENTED) return respond(request, {"result": msg})
def test_get_datetime_missing(self): assert not get_datetime(self.request, 'missing')
def test_get_datetime_invalid(self): self._add_arg('nope', '2012-333-4') assert not get_datetime(self.request, 'nope')
def test_get_datetime_valid(self): assert_equal(get_datetime(self.request, 'datetime'), self.datetime)