From 7572a974363ea32cc63931e3870ff22d6e6af109 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 28 Jun 2021 08:44:23 +0100 Subject: [PATCH] Use new permissions for 'Prepare broadcast' button on templates page --- app/templates/views/templates/_template.html | 2 +- tests/app/main/views/test_templates.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/templates/views/templates/_template.html b/app/templates/views/templates/_template.html index bcb73f2b2..79aa47953 100644 --- a/app/templates/views/templates/_template.html +++ b/app/templates/views/templates/_template.html @@ -28,7 +28,7 @@ {% endif %} {% elif template.template_type == 'broadcast' %} - {% if current_user.has_permissions('send_messages') %} + {% if current_user.has_permissions('send_messages', 'create_broadcasts') %}
Get ready to send diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index af4c6239f..91697755c 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -22,7 +22,9 @@ from tests.conftest import ( TEMPLATE_ONE_ID, ElementNotFound, create_active_caseworking_user, + create_active_user_create_broadcasts_permissions, create_active_user_view_permissions, + create_active_user_with_permissions, create_letter_contact_block, create_template, normalize_spaces, @@ -894,14 +896,19 @@ def test_should_be_able_to_view_a_template_with_links( ) +@pytest.mark.parametrize('user', ( + create_active_user_with_permissions(), + create_active_user_create_broadcasts_permissions(), +)) def test_view_broadcast_template( client_request, service_one, mock_get_broadcast_template, mock_get_template_folders, - active_user_with_permissions, fake_uuid, + user, ): + client_request.login(user) page = client_request.get( '.view_template', service_id=SERVICE_ONE_ID,