diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index f7af4bdf4..f7351249f 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -44,22 +44,24 @@ def get_status_arg(filter_args): @user_has_permissions('view_activity', admin_override=True) def view_notification(service_id, notification_id): notification = notification_api_client.get_notification(service_id, notification_id) + template = get_template( + notification['template'], + current_service, + letter_preview_url=url_for( + '.view_template_version_preview', + service_id=service_id, + template_id=notification['template']['id'], + version=notification['template_version'], + filetype='png', + ), + show_recipient=True, + ) + template.values = notification['personalisation'] return render_template( 'views/notifications/notification.html', finished=(notification['status'] in (DELIVERED_STATUSES + FAILURE_STATUSES)), uploaded_file_name='Report', - template=get_template( - notification['template'], - current_service, - letter_preview_url=url_for( - '.view_template_version_preview', - service_id=service_id, - template_id=notification['template']['id'], - version=notification['template_version'], - filetype='png', - ), - show_recipient=True, - ), + template=template, updates_url=url_for( ".view_notification_updates", service_id=service_id, diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 7decfcd80..10cfa2485 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -44,7 +44,7 @@ def test_notification_status_page_shows_details( ) assert normalize_spaces(page.select('.sms-message-wrapper')[0].text) == ( - 'service one: template content' + 'service one: hello Jo' ) assert normalize_spaces(page.select('.ajax-block-container p')[0].text) == ( expected_status diff --git a/tests/conftest.py b/tests/conftest.py index 7f556c22d..d4c1f6754 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1635,7 +1635,8 @@ def mock_get_notification(mocker, fake_uuid, notification_status='delivered'): 'name': 'Test User', 'email_address': 'test@user.gov.uk' } - noti['template'] = template_json(service_id, str(generate_uuid())) + noti['personalisation'] = {'name': 'Jo'} + noti['template'] = template_json(service_id, str(generate_uuid()), content='hello ((name))') return noti return mocker.patch(