def schedule(): if request.method == 'GET': return jsonify({'success': False}) message_id = request.form.get('m_id', None) subject = request.form.get('subj', None) if message_id: print 'Scheduling bump...' print '\tsubject:', subject print '\tmessage id:', message_id scheduled_for = datetime.datetime.now() + datetime.timedelta(days=5) # TODO jobs.add(subject, message_id, scheduled_for) return jsonify({'success': True})
def schedule(): if request.method == 'GET': return jsonify({'success': False}) message_id = request.form.get('m_id', None) subject = request.form.get('subj', None) if message_id: print 'Scheduling bump...' print '\tsubject:', subject print '\tmessage id:', message_id scheduled_for = datetime.datetime.now() + datetime.timedelta( days=5) # TODO jobs.add(subject, message_id, scheduled_for) return jsonify({'success': True})
def test_get_jobs_info_filter(self): foo = FooJob() jobs.add(foo) bar = BarJob() jobs.add(bar) self.assertEqual({bar.id: bar.info()}, jobs.info(bar.job_type))
def test_get_job(self): job = TestingJob() jobs.add(job) self.assertEqual(job.id, jobs.get(job.id).id)
def test_get_jobs_info(self): foo = FooJob() jobs.add(foo) bar = BarJob() jobs.add(bar) self.assertEqual({foo.id: foo.info(), bar.id: bar.info()}, jobs.info())
def test_add_existing_job(self): job = TestingJob() jobs.add(job) self.assertRaises(jobs.JobExistsError, jobs.add, job)
def test_add_job(self): job = TestingJob() jobs.add(job) self.assertEqual(1, len(jobs._jobs))
def test_delete_running_job(self): job = TestingJob() jobs.add(job) self.assertEqual(response.error(jobs.JobNotDone.name), jobs.delete(job.id))
def test_delete_job(self, status): job = TestingJob() job._status = status jobs.add(job) self.assertEqual(response.success(), jobs.delete(job.id))
def test_abort_job(self): job = TestingJob() jobs.add(job) jobs.abort(job.id) self.assertEqual(jobs.STATUS.ABORTED, job.status) self.assertTrue(job._aborted)