From 1391f122398c49560123d4b826e7c67eb84a3556 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 2 Mar 2018 14:03:32 +0000 Subject: [PATCH] Remove anything to do with DVLA format letters --- app/main/views/templates.py | 30 +--------------- requirements.txt | 2 +- tests/app/main/views/test_templates.py | 47 -------------------------- 3 files changed, 2 insertions(+), 77 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 932eef8f3..0fc06cd3b 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -2,21 +2,12 @@ from datetime import datetime, timedelta from string import ascii_uppercase from dateutil.parser import parse -from flask import ( - Response, - abort, - flash, - redirect, - render_template, - request, - url_for, -) +from flask import abort, flash, redirect, render_template, request, url_for from flask_login import current_user, login_required from markupsafe import Markup from notifications_python_client.errors import HTTPError from notifications_utils.formatters import nl2br from notifications_utils.recipients import first_column_headings -from notifications_utils.template import LetterDVLATemplate from app import current_service, service_api_client, template_statistics_client from app.main import main @@ -159,25 +150,6 @@ def choose_template(service_id, template_type='all'): ) -@main.route("/services//templates//as-dvla") -@login_required -@user_has_permissions(admin_override=True) -def view_template_as_dvla_markup(service_id, template_id): - - template = service_api_client.get_service_template(service_id, str(template_id))['data'] - - if template['template_type'] != 'letter': - abort(404) - - return Response( - str(LetterDVLATemplate( - template, - notification_reference=1, - )), - mimetype='text/plain', - ) - - @main.route("/services//templates/.") @login_required @user_has_permissions('view_activity', admin_override=True) diff --git a/requirements.txt b/requirements.txt index 3cb8d632a..c19267933 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ notifications-python-client==4.7.2 # PaaS awscli-cwlogs>=1.4,<1.5 -git+https://github.com/alphagov/notifications-utils.git@23.8.1#egg=notifications-utils==23.8.1 +git+https://github.com/alphagov/notifications-utils.git@24.0.0#egg=notifications-utils==24.0.0 diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 7b4c8c45d..803703564 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -13,13 +13,11 @@ from tests import ( ) from tests.conftest import ( SERVICE_ONE_ID, - active_user_with_permissions, mock_get_service_email_template, mock_get_service_letter_template, mock_get_service_template, no_letter_contact_blocks, normalize_spaces, - platform_admin_user, ) from tests.conftest import service_one as create_sample_service from tests.conftest import single_letter_contact_block @@ -1229,51 +1227,6 @@ def test_should_show_hint_once_template_redacted( assert page.select('.hint')[0].text == 'Personalisation is hidden after sending' -@pytest.mark.parametrize('test_user, template_mock, expected_response_code', [ - ( - active_user_with_permissions, - mock_get_service_letter_template, - 403 - ), - ( - platform_admin_user, - mock_get_service_template, - 404 - ), - ( - platform_admin_user, - mock_get_service_email_template, - 404 - ), - ( - platform_admin_user, - mock_get_service_letter_template, - 200 - ), -]) -def test_should_show_letter_template_as_dvla_markup( - client, - mocker, - service_one, - fake_uuid, - mock_get_service, - test_user, - template_mock, - expected_response_code, -): - - client.login(test_user(fake_uuid), mocker, service_one) - template_mock(mocker) - - response = client.get(url_for( - '.view_template_as_dvla_markup', - service_id=SERVICE_ONE_ID, - template_id=fake_uuid, - )) - - assert response.status_code == expected_response_code - - def test_set_template_sender( client_request, fake_uuid,