From 5d4e942fa15c3f4231948813e1f5f010bfbb7dd6 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 2 Sep 2016 12:24:14 +0100 Subject: [PATCH] Use fixture for testing scheduled jobs --- tests/app/dao/test_jobs_dao.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/app/dao/test_jobs_dao.py b/tests/app/dao/test_jobs_dao.py index 0c23bad9d..69efcd08d 100644 --- a/tests/app/dao/test_jobs_dao.py +++ b/tests/app/dao/test_jobs_dao.py @@ -247,15 +247,15 @@ def test_get_scheduled_jobs_gets_ignores_jobs_not_scheduled(notify_db, notify_db assert jobs[0].id == job_scheduled.id -def test_get_scheduled_jobs_gets_ignores_jobs_scheduled_in_the_future(notify_db, notify_db_session): - one_minute_in_the_future = datetime.utcnow() + timedelta(minutes=1) - sample_job(notify_db, notify_db_session, scheduled_for=one_minute_in_the_future, job_status='scheduled') +def test_get_scheduled_jobs_gets_ignores_jobs_scheduled_in_the_future( + notify_db, notify_db_session, sample_scheduled_job +): jobs = dao_get_scheduled_jobs() assert len(jobs) == 0 -def test_get_future_scheduled_job_gets_a_job_yet_to_send(notify_db, notify_db_session): - one_hour_from_now = datetime.utcnow() + timedelta(minutes=60) - job = sample_job(notify_db, notify_db_session, scheduled_for=one_hour_from_now, job_status='scheduled') - result = dao_get_future_scheduled_job_by_id_and_service_id(job.id, job.service_id) - assert result.id == job.id +def test_get_future_scheduled_job_gets_a_job_yet_to_send( + notify_db, notify_db_session, sample_scheduled_job +): + result = dao_get_future_scheduled_job_by_id_and_service_id(sample_scheduled_job.id, sample_scheduled_job.service_id) + assert result.id == sample_scheduled_job.id