Don't send test letters to dvla to print

This commit is contained in:
David McDonald
2020-02-19 13:36:05 +00:00
parent 7578e01b3b
commit 6226d9e122
2 changed files with 11 additions and 1 deletions

View File

@@ -742,7 +742,8 @@ def dao_get_letters_to_be_printed(print_run_date):
notifications = Notification.query.filter(
Notification.created_at < convert_bst_to_utc(last_processing_deadline),
Notification.notification_type == LETTER_TYPE,
Notification.status == NOTIFICATION_CREATED
Notification.status == NOTIFICATION_CREATED,
Notification.key_type == KEY_TYPE_NORMAL
).order_by(
Notification.created_at
).all()

View File

@@ -281,6 +281,15 @@ def test_get_key_and_size_of_letters_to_be_sent_to_print(notify_api, mocker, sam
created_at=(datetime.now() - timedelta(minutes=1)).isoformat()
)
# test notification we don't expect to get sent
create_notification(
template=sample_letter_template,
status='created',
reference='ref4',
created_at=(datetime.now() - timedelta(days=1)).isoformat(),
key_type=KEY_TYPE_TEST
)
mock_s3 = mocker.patch('app.celery.tasks.s3.head_s3_object', side_effect=[
{'ContentLength': 2},
{'ContentLength': 1},