From b07f16b9a0337a5e38ff63431802b723492f35d0 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Mon, 4 Feb 2019 17:28:14 +0000 Subject: [PATCH] Don't use service default postage, but template postage instead --- app/main/views/jobs.py | 2 +- app/notify_client/service_api_client.py | 1 - app/templates/views/templates/_template.html | 2 -- tests/app/main/views/test_jobs.py | 4 ++-- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index 36ba99da0..33c4d782e 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -390,7 +390,7 @@ def get_job_partials(job, template): if notifications['notifications']: postage = notifications['notifications'][0]['postage'] else: - postage = current_service.postage + postage = template['postage'] counts = render_template( 'partials/jobs/count-letters.html', diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 4b4b87ea1..75e3bdb04 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -83,7 +83,6 @@ class ServiceAPIClient(NotifyAdminAPIClient): 'free_sms_fragment_limit', 'prefix_sms', 'contact_link', - 'postage', } if disallowed_attributes: raise TypeError('Not allowed to update service attributes: {}'.format( diff --git a/app/templates/views/templates/_template.html b/app/templates/views/templates/_template.html index 4e9198579..e99b1ec39 100644 --- a/app/templates/views/templates/_template.html +++ b/app/templates/views/templates/_template.html @@ -22,12 +22,10 @@ {% endif %} - {% if current_service.has_permission("choose_postage") %}

Postage

: {{ template_postage or current_service.postage }} class
- {% endif %} {% else %} {% if current_user.has_permissions('send_messages', restrict_admin_usage=True) %}
diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 300dadb23..b47000a37 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -11,6 +11,7 @@ from tests.conftest import ( active_caseworking_user, active_user_with_permissions, mock_get_notifications, + mock_get_service_letter_template, normalize_spaces, ) @@ -553,7 +554,6 @@ def test_should_show_letter_job_with_first_class_if_notifications_are_first_clas def test_should_show_letter_job_with_first_class_if_no_notifications( client_request, service_one, - mock_get_service_letter_template, mock_get_job, fake_uuid, mock_get_notifications_with_no_notifications, @@ -561,7 +561,7 @@ def test_should_show_letter_job_with_first_class_if_no_notifications( mocker ): - service_one['postage'] = 'first' + mock_get_service_letter_template(mocker, postage="first") page = client_request.get( 'main.view_job',