def test_get_jobs_from_disk(self): temp = tempfile.mkdtemp() file = '/'.join([temp, "test.conf"]) data = '{"job_id": "test"}' with open(file, 'wb') as f: f.write(data) ret = utils.get_jobs_from_disk(temp) self.assertEqual(job_list, ret) shutil.rmtree(temp) self.assertFalse(os.path.exists(file))
def get_jobs(self): if self.client: job_doc_list = utils.get_active_jobs_from_api(self.client) try: utils.save_jobs_to_disk(job_doc_list, self.job_path) except Exception as e: LOG.error('Unable to save jobs to {0}. ' '{1}'.format(self.job_path, e)) return job_doc_list else: return utils.get_jobs_from_disk(self.job_path)
def get_jobs(self): if self.client: job_doc_list = utils.get_active_jobs_from_api(self.client) try: utils.save_jobs_to_disk(job_doc_list, self.job_path) except Exception as e: LOG.error('Unable to save jobs to {0}. ' '{1}'.format(self.job_path, e)) return job_doc_list else: return utils.get_jobs_from_disk(self.job_path)