diff --git a/app/celery/tasks.py b/app/celery/tasks.py index f746512be..cdf5dc7d2 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -274,6 +274,7 @@ def build_dvla_file(self, job_id): # This unique id is a 7 digits requested by DVLA, not known # if this number needs to be sequential. numeric_id=random.randint(1, int('9' * 7)), + contact_block=notification.service.letter_contact_block, )) for notification in dao_get_all_notifications_for_job(job_id) ) diff --git a/tests/app/celery/test_tasks.py b/tests/app/celery/test_tasks.py index 80b83756c..671d52189 100644 --- a/tests/app/celery/test_tasks.py +++ b/tests/app/celery/test_tasks.py @@ -994,6 +994,7 @@ def test_build_dvla_file(sample_letter_template, mocker): # Named arguments assert mocked_letter_template.call_args[1]['numeric_id'] == 999 + assert mocked_letter_template.call_args[1]['contact_block'] == 'London,\nSW1A 1AA' def test_build_dvla_file_retries_if_all_notifications_are_not_created(sample_letter_template, mocker): diff --git a/tests/app/conftest.py b/tests/app/conftest.py index 387bb33eb..0805242b7 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -134,7 +134,8 @@ def sample_service( 'message_limit': limit, 'restricted': restricted, 'email_from': email_from, - 'created_by': user + 'created_by': user, + 'letter_contact_block': 'London,\nSW1A 1AA', } service = Service.query.filter_by(name=service_name).first() if not service: