diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 3ba0bb706..ca27f94f0 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -46,9 +46,8 @@ def view_notification(service_id, notification_id): notification = notification_api_client.get_notification(service_id, str(notification_id)) notification['template'].update({'reply_to_text': notification['reply_to_text']}) - file_contents = view_letter_notification_as_preview(service_id, notification_id, "pdf") - if notification['template']['is_precompiled_letter']: + file_contents = view_letter_notification_as_preview(service_id, notification_id, "pdf") page_count = pdf_page_count(io.BytesIO(file_contents)) else: page_count = get_page_count_for_letter(notification['template']) diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index a4034f4f6..0adbe6908 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -166,7 +166,7 @@ def test_should_show_image_of_letter_notification( mock_get_notification(mocker, fake_uuid, template_type='letter') mocker.patch( - 'app.notify_client.notification_api_client.NotificationApiClient.get', + 'app.main.views.notifications.notification_api_client.get_notification_letter_preview', return_value={ 'content': base64.b64encode(b'foo').decode('utf-8') } @@ -192,7 +192,7 @@ def test_should_show_preview_error_image_letter_notification_on_preview_error( mock_get_notification(mocker, fake_uuid, template_type='letter') mocker.patch( - 'app.notify_client.notification_api_client.NotificationApiClient.get', + 'app.main.views.notifications.notification_api_client.get_notification_letter_preview', side_effect=APIError ) @@ -366,7 +366,7 @@ def test_should_show_image_of_precompiled_letter_notification( ) mocker.patch( - 'app.notify_client.notification_api_client.NotificationApiClient.get', + 'app.main.views.notifications.notification_api_client.get_notification_letter_preview', return_value={ 'content': base64.b64encode(b'foo').decode('utf-8') }