Don't log address redaction failure when letter sent with test key

This commit is contained in:
Pea Tyczynska
2019-09-17 15:55:26 +01:00
parent 99eb17fc29
commit 1279a46b8b
2 changed files with 8 additions and 5 deletions

View File

@@ -228,7 +228,7 @@ def process_virus_scan_passed(self, filename):
new_pdf = sanitise_response.content
redaction_failed_message = sanitise_response.get("redaction_failed_message")
if redaction_failed_message:
if redaction_failed_message and not is_test_key:
current_app.logger.info('{} for notification id {} ({})'.format(
redaction_failed_message, notification.id, filename)
)

View File

@@ -532,10 +532,13 @@ def test_process_letter_task_check_virus_scan_passed_when_redaction_fails(
assert sample_letter_notification.billable_units == 2
assert sample_letter_notification.status == notification_status
mock_copy_s3.assert_called_once_with(
bucket_name, filename,
bucket_name, 'REDACTION_FAILURE/' + filename
)
if key_type == KEY_TYPE_NORMAL:
mock_copy_s3.assert_called_once_with(
bucket_name, filename,
bucket_name, 'REDACTION_FAILURE/' + filename
)
else:
mock_copy_s3.assert_not_called()
@freeze_time('2018-01-01 18:00')