mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 14:08:47 -04:00
Change job selection dao to take flexible retention into account
Also test deleting jobs with flexible data retention Also update tests for default data retention following logic change: dao_get_jobs_older_than_data_retention now counts today at the start of the day, not at a time when function runs and updated tests reflect that
This commit is contained in:
committed by
Alexey Bezhan
parent
744389f557
commit
be6f37069b
@@ -13,7 +13,7 @@ from app.dao.jobs_dao import (
|
||||
dao_set_scheduled_jobs_to_pending,
|
||||
dao_get_future_scheduled_job_by_id_and_service_id,
|
||||
dao_get_notification_outcomes_for_job,
|
||||
dao_get_jobs_older_than_limited_by
|
||||
dao_get_jobs_older_than_data_retention,
|
||||
)
|
||||
from app.models import (
|
||||
Job,
|
||||
@@ -296,7 +296,7 @@ def test_should_get_jobs_seven_days_old(notify_db, notify_db_session, sample_tem
|
||||
job(created_at=nine_days_ago)
|
||||
job(created_at=nine_days_one_second_ago)
|
||||
|
||||
jobs = dao_get_jobs_older_than_limited_by(job_types=[sample_template.template_type])
|
||||
jobs = dao_get_jobs_older_than_data_retention(notification_types=[sample_template.template_type])
|
||||
|
||||
assert len(jobs) == 1
|
||||
assert jobs[0].id == job_to_delete.id
|
||||
@@ -359,8 +359,8 @@ def test_should_get_jobs_seven_days_old_filters_type(notify_db, notify_db_sessio
|
||||
job(template=sms_template)
|
||||
job(template=email_template)
|
||||
|
||||
jobs = dao_get_jobs_older_than_limited_by(
|
||||
job_types=[EMAIL_TYPE, SMS_TYPE]
|
||||
jobs = dao_get_jobs_older_than_data_retention(
|
||||
notification_types=[EMAIL_TYPE, SMS_TYPE]
|
||||
)
|
||||
|
||||
assert len(jobs) == 2
|
||||
|
||||
Reference in New Issue
Block a user