def test_get_status_from_db(self): self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db') session = get_db_session("reslt", "writer") session.query(OqJob).update({'status': 'failed'}) session.commit() self.assertEqual(Job.get_status_from_db(self.job.job_id), 'failed') session.query(OqJob).update({'status': 'running'}) session.commit() self.assertEqual(Job.get_status_from_db(self.job.job_id), 'running')
def test_get_status_from_db(self): self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db') row = OqJob.objects.get(id=self.job.job_id) row.status = "failed" row.save() self.assertEqual("failed", Job.get_status_from_db(self.job.job_id)) row.status = "running" row.save() self.assertEqual("running", Job.get_status_from_db(self.job.job_id))