def test_get_event_str_job_execution_event(self): scheduled_run_time = datetime.strptime("10/04/18 19:02", "%d/%m/%y %H:%M") event = JobExecutionEvent("code", "job_id", "jobstore", scheduled_run_time, retval=1) message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEqual( "JobExecutionEvent [code] [job_id] [jobstore] [2018-04-10 19:02:00] [1]", message)
def test_get_event_unknown(self): event = unittest.mock.Mock() message = ProgramyScheduler.get_event_str(event) self.assertIsNone(message)
def test_get_event_str_job_submission_event(self): event = JobSubmissionEvent("code", "job_id", "jobstore", []) message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEqual("JobSubmissionEvent [code] [job_id] [jobstore] [[]]", message)
def test_get_event_str_job_event(self): event = JobEvent("code", "id", "jobstore") message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEqual("JobEvent [code] [id] [jobstore] [None]", message)
def test_get_event_str_scheduler_event(self): event = SchedulerEvent("code", "alias") message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEqual("SchedulerEvent [code] [alias]", message)
def test_get_event_unknown(self): event = unittest.mock.Mock() message = ProgramyScheduler.get_event_str(event) self.assertIsNone(message)
def test_get_event_str_job_execution_event_with_exception(self): scheduled_run_time = datetime.strptime("10/04/18 19:02", "%d/%m/%y %H:%M") event = JobExecutionEvent ("code", "job_id", "jobstore", scheduled_run_time, retval=1, exception=Exception("Test Error")) message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEquals("JobExecutionEvent [code] [job_id] [jobstore] [2018-04-10 19:02:00] [1] [Test Error]", message)
def test_get_event_str_job_submission_event(self): event = JobSubmissionEvent ("code", "job_id", "jobstore", []) message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEquals("JobSubmissionEvent [code] [job_id] [jobstore] [[]]", message)
def test_get_event_str_job_event(self): event = JobEvent ("code", "id", "jobstore") message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEquals("JobEvent [code] [id] [jobstore] [None]", message)
def test_get_event_str_scheduler_event(self): event = SchedulerEvent("code", "alias") message = ProgramyScheduler.get_event_str(event) self.assertIsNotNone(message) self.assertEquals("SchedulerEvent [code] [alias]", message)