

def test_crontab_persisted_correctly(self):
    '\n        Ensure that crontab attribute gets correctly saved in Redis.\n        '
    job = self.scheduler.cron('1 * * * *', say_hello)
    job_from_queue = Job.fetch(job.id, connection=self.testconn)
    self.assertEqual(job_from_queue.meta['cron_string'], '1 * * * *')
    unix_time = self.testconn.zscore(self.scheduler.scheduled_jobs_key, job.id)
    datetime_time = from_unix(unix_time)
    assert (datetime_time.minute == 1)
    assert (datetime_time.second == 0)
    assert ((datetime_time - datetime.utcnow()) < timedelta(hours=1))

dataset/ETHPy150Open ui/rq-scheduler/tests/test_scheduler.py TestScheduler.test_crontab_persisted_correctly/original