From aa69139fd175cfc5eb31ba76589385c97f941905 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 2 Mar 2020 14:07:39 +0000 Subject: [PATCH] Remove check on permission to upload letters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Soon enough every service will have this permission, and they won’t be able to switch it off. So we should clean up our codebase and make it so there’s no dependancy on a row existing in the permissions table. This is the first step of that process for the API. Before we can remove it, we have to stop checking from it. Next step will be to stop inserting the permission, then finally remove it from the database. --- app/service/send_notification.py | 2 -- tests/app/service/test_send_pdf_letter_notification.py | 1 - 2 files changed, 3 deletions(-) diff --git a/app/service/send_notification.py b/app/service/send_notification.py index 12813ea95..a7886b624 100644 --- a/app/service/send_notification.py +++ b/app/service/send_notification.py @@ -26,7 +26,6 @@ from app.models import ( EMAIL_TYPE, LETTER_TYPE, NOTIFICATION_DELIVERED, - UPLOAD_LETTERS, ) from app.dao.services_dao import dao_fetch_service_by_id from app.dao.templates_dao import dao_get_template_by_id_and_service_id, get_precompiled_letter_template @@ -139,7 +138,6 @@ def send_pdf_letter_notification(service_id, post_data): service = dao_fetch_service_by_id(service_id) check_service_has_permission(LETTER_TYPE, service.permissions) - check_service_has_permission(UPLOAD_LETTERS, service.permissions) check_service_over_daily_message_limit(KEY_TYPE_NORMAL, service) validate_created_by(service, post_data['created_by']) validate_and_format_recipient( diff --git a/tests/app/service/test_send_pdf_letter_notification.py b/tests/app/service/test_send_pdf_letter_notification.py index 118a9dda2..f5772095c 100644 --- a/tests/app/service/test_send_pdf_letter_notification.py +++ b/tests/app/service/test_send_pdf_letter_notification.py @@ -13,7 +13,6 @@ from tests.app.db import create_service @pytest.mark.parametrize('permissions', [ [EMAIL_TYPE], - [LETTER_TYPE], [UPLOAD_LETTERS], ]) def test_send_pdf_letter_notification_raises_error_if_service_does_not_have_permission(