mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-25 01:41:34 -05:00
Use fixture for testing scheduled jobs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user