mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Merge pull request #2841 from alphagov/jobs-by-contact-list
Allow jobs to be grouped by contact list
This commit is contained in:
@@ -25,7 +25,7 @@ from app.models import (
|
||||
EMAIL_TYPE, SMS_TYPE, LETTER_TYPE,
|
||||
JOB_STATUS_FINISHED
|
||||
)
|
||||
from tests.app.db import create_job, create_service, create_template, create_notification
|
||||
from tests.app.db import create_job, create_service, create_template, create_notification, create_service_contact_list
|
||||
|
||||
|
||||
def test_should_have_decorated_notifications_dao_functions():
|
||||
@@ -168,6 +168,26 @@ def test_get_jobs_for_service_in_processed_at_then_created_at_order(notify_db, n
|
||||
assert jobs[index].id == created_jobs[index].id
|
||||
|
||||
|
||||
def test_get_jobs_for_service_by_contact_list(sample_template):
|
||||
contact_list = create_service_contact_list()
|
||||
job_1 = create_job(sample_template)
|
||||
job_2 = create_job(sample_template, contact_list_id=contact_list.id)
|
||||
|
||||
assert dao_get_jobs_by_service_id(
|
||||
sample_template.service.id
|
||||
).items == [
|
||||
job_2,
|
||||
job_1,
|
||||
]
|
||||
|
||||
assert dao_get_jobs_by_service_id(
|
||||
sample_template.service.id,
|
||||
contact_list_id=contact_list.id,
|
||||
).items == [
|
||||
job_2,
|
||||
]
|
||||
|
||||
|
||||
def test_update_job(sample_job):
|
||||
assert sample_job.job_status == 'pending'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user