Revert "Bump utils version for new invalid address character"

This commit is contained in:
David McDonald
2021-06-01 10:53:28 +01:00
committed by GitHub
parent 4f40c12f6e
commit 04e23ca6a9
11 changed files with 67 additions and 51 deletions

View File

@@ -273,34 +273,48 @@ def register_blueprint(application):
def register_v2_blueprints(application): def register_v2_blueprints(application):
from app.authentication.auth import requires_auth from app.authentication.auth import requires_auth
from app.v2.broadcast.post_broadcast import v2_broadcast_blueprint from app.v2.broadcast.post_broadcast import (
from app.v2.inbound_sms.get_inbound_sms import v2_inbound_sms_blueprint v2_broadcast_blueprint as post_broadcast,
from app.v2.notifications import ( # noqa
get_notifications,
post_notifications,
v2_notification_blueprint,
) )
from app.v2.template import ( # noqa from app.v2.inbound_sms.get_inbound_sms import (
get_template, v2_inbound_sms_blueprint as get_inbound_sms,
post_template, )
v2_template_blueprint, from app.v2.notifications.get_notifications import (
v2_notification_blueprint as get_notifications,
)
from app.v2.notifications.post_notifications import (
v2_notification_blueprint as post_notifications,
)
from app.v2.template.get_template import (
v2_template_blueprint as get_template,
)
from app.v2.template.post_template import (
v2_template_blueprint as post_template,
)
from app.v2.templates.get_templates import (
v2_templates_blueprint as get_templates,
) )
from app.v2.templates.get_templates import v2_templates_blueprint
v2_notification_blueprint.before_request(requires_auth) post_notifications.before_request(requires_auth)
application.register_blueprint(v2_notification_blueprint) application.register_blueprint(post_notifications)
v2_template_blueprint.before_request(requires_auth) get_notifications.before_request(requires_auth)
application.register_blueprint(v2_template_blueprint) application.register_blueprint(get_notifications)
v2_templates_blueprint.before_request(requires_auth) get_templates.before_request(requires_auth)
application.register_blueprint(v2_templates_blueprint) application.register_blueprint(get_templates)
v2_inbound_sms_blueprint.before_request(requires_auth) get_template.before_request(requires_auth)
application.register_blueprint(v2_inbound_sms_blueprint) application.register_blueprint(get_template)
v2_broadcast_blueprint.before_request(requires_auth) post_template.before_request(requires_auth)
application.register_blueprint(v2_broadcast_blueprint) application.register_blueprint(post_template)
get_inbound_sms.before_request(requires_auth)
application.register_blueprint(get_inbound_sms)
post_broadcast.before_request(requires_auth)
application.register_blueprint(post_broadcast)
def init_app(app): def init_app(app):

View File

@@ -265,7 +265,7 @@ def validate_address(service, letter_data):
) )
if address.has_invalid_characters: if address.has_invalid_characters:
raise ValidationError( raise ValidationError(
message='Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / , < > ~' message='Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / , < >'
) )
if address.international: if address.international:
return address.postage return address.postage

View File

@@ -55,7 +55,7 @@ def get_pdf_for_notification(notification_id):
except Exception: except Exception:
raise PDFNotReadyError() raise PDFNotReadyError()
return send_file(path_or_file=BytesIO(pdf_data), mimetype='application/pdf') return send_file(filename_or_fp=BytesIO(pdf_data), mimetype='application/pdf')
@v2_notification_blueprint.route("", methods=['GET']) @v2_notification_blueprint.route("", methods=['GET'])

View File

@@ -8,12 +8,12 @@ Flask-Bcrypt==0.7.1
flask-marshmallow==0.14.0 flask-marshmallow==0.14.0
Flask-Migrate==2.7.0 Flask-Migrate==2.7.0
git+https://github.com/mitsuhiko/flask-sqlalchemy.git@500e732dd1b975a56ab06a46bd1a20a21e682262#egg=Flask-SQLAlchemy==2.3.2.dev20190108 git+https://github.com/mitsuhiko/flask-sqlalchemy.git@500e732dd1b975a56ab06a46bd1a20a21e682262#egg=Flask-SQLAlchemy==2.3.2.dev20190108
Flask==2.0.1 Flask==1.1.2
click-datetime==0.2 click-datetime==0.2
eventlet==0.30.2 # pyup: ignore # 0.31 breaks Gunicorn eventlet==0.30.2 # pyup: ignore # 0.31 breaks Gunicorn
gunicorn==20.1.0 gunicorn==20.1.0
iso8601==0.1.14 iso8601==0.1.14
itsdangerous==2.0.1 itsdangerous==1.1.0
jsonschema==3.2.0 jsonschema==3.2.0
marshmallow-sqlalchemy==0.23.1 # pyup: <0.24.0 # marshmallow v3 throws errors marshmallow-sqlalchemy==0.23.1 # pyup: <0.24.0 # marshmallow v3 throws errors
marshmallow==2.21.0 # pyup: <3 # v3 throws errors marshmallow==2.21.0 # pyup: <3 # v3 throws errors
@@ -34,7 +34,7 @@ notifications-python-client==6.0.2
# PaaS # PaaS
awscli-cwlogs==1.4.6 awscli-cwlogs==1.4.6
git+https://github.com/alphagov/notifications-utils.git@44.2.2#egg=notifications-utils==44.2.2 git+https://github.com/alphagov/notifications-utils.git@44.1.0#egg=notifications-utils==44.1.0
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains # gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.10.1 prometheus-client==0.10.1

View File

@@ -10,12 +10,12 @@ Flask-Bcrypt==0.7.1
flask-marshmallow==0.14.0 flask-marshmallow==0.14.0
Flask-Migrate==2.7.0 Flask-Migrate==2.7.0
git+https://github.com/mitsuhiko/flask-sqlalchemy.git@500e732dd1b975a56ab06a46bd1a20a21e682262#egg=Flask-SQLAlchemy==2.3.2.dev20190108 git+https://github.com/mitsuhiko/flask-sqlalchemy.git@500e732dd1b975a56ab06a46bd1a20a21e682262#egg=Flask-SQLAlchemy==2.3.2.dev20190108
Flask==2.0.1 Flask==1.1.2
click-datetime==0.2 click-datetime==0.2
eventlet==0.30.2 # pyup: ignore # 0.31 breaks Gunicorn eventlet==0.30.2 # pyup: ignore # 0.31 breaks Gunicorn
gunicorn==20.1.0 gunicorn==20.1.0
iso8601==0.1.14 iso8601==0.1.14
itsdangerous==2.0.1 itsdangerous==1.1.0
jsonschema==3.2.0 jsonschema==3.2.0
marshmallow-sqlalchemy==0.23.1 # pyup: <0.24.0 # marshmallow v3 throws errors marshmallow-sqlalchemy==0.23.1 # pyup: <0.24.0 # marshmallow v3 throws errors
marshmallow==2.21.0 # pyup: <3 # v3 throws errors marshmallow==2.21.0 # pyup: <3 # v3 throws errors
@@ -36,28 +36,28 @@ notifications-python-client==6.0.2
# PaaS # PaaS
awscli-cwlogs==1.4.6 awscli-cwlogs==1.4.6
git+https://github.com/alphagov/notifications-utils.git@44.2.2#egg=notifications-utils==44.2.2 git+https://github.com/alphagov/notifications-utils.git@44.1.0#egg=notifications-utils==44.1.0
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains # gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.10.1 prometheus-client==0.10.1
gds-metrics==0.2.4 gds-metrics==0.2.4
## The following requirements were added by pip freeze: ## The following requirements were added by pip freeze:
alembic==1.6.4 alembic==1.6.2
amqp==1.4.9 amqp==1.4.9
anyjson==0.3.3 anyjson==0.3.3
attrs==21.2.0 attrs==21.2.0
awscli==1.19.82 awscli==1.19.69
bcrypt==3.2.0 bcrypt==3.2.0
billiard==3.3.0.23 billiard==3.3.0.23
bleach==3.3.0 bleach==3.3.0
blinker==1.4 blinker==1.4
boto==2.49.0 boto==2.49.0
boto3==1.17.82 boto3==1.17.69
botocore==1.20.82 botocore==1.20.69
certifi==2020.12.5 certifi==2020.12.5
chardet==4.0.0 chardet==4.0.0
click==8.0.1 click==7.1.2
colorama==0.4.3 colorama==0.4.3
dnspython==1.16.0 dnspython==1.16.0
docutils==0.15.2 docutils==0.15.2
@@ -66,15 +66,15 @@ geojson==2.5.0
govuk-bank-holidays==0.8 govuk-bank-holidays==0.8
greenlet==1.1.0 greenlet==1.1.0
idna==2.10 idna==2.10
Jinja2==3.0.1 Jinja2==2.11.3
jmespath==0.10.0 jmespath==0.10.0
kombu==3.0.37 kombu==3.0.37
Mako==1.1.4 Mako==1.1.4
MarkupSafe==2.0.1 MarkupSafe==1.1.1
mistune==0.8.4 mistune==0.8.4
orderedset==2.0.3 orderedset==2.0.3
packaging==20.9 packaging==20.9
phonenumbers==8.12.23 phonenumbers==8.12.22
pyasn1==0.4.8 pyasn1==0.4.8
pycparser==2.20 pycparser==2.20
pyparsing==2.4.7 pyparsing==2.4.7
@@ -94,6 +94,6 @@ six==1.16.0
smartypants==2.0.1 smartypants==2.0.1
soupsieve==2.2.1 soupsieve==2.2.1
statsd==3.3.0 statsd==3.3.0
urllib3==1.26.5 urllib3==1.26.4
webencodings==0.5.1 webencodings==0.5.1
Werkzeug==2.0.1 Werkzeug==1.0.1

View File

@@ -2,13 +2,13 @@
flake8==3.8.4 flake8==3.8.4
flake8-bugbear==20.11.1 flake8-bugbear==20.11.1
isort==5.7.0 isort==5.7.0
moto==2.0.8 moto==1.3.16
pytest==6.2.4 pytest==6.1.2
pytest-env==0.6.2 pytest-env==0.6.2
pytest-mock==3.6.1 pytest-mock==3.3.1
pytest-cov==2.12.0 pytest-cov==2.10.1
pytest-xdist==2.2.1 pytest-xdist==2.1.0
freezegun==1.1.0 freezegun==1.1.0
requests-mock==1.9.2 requests-mock==1.8.0
# used for creating manifest file locally # used for creating manifest file locally
jinja2-cli[yaml]==0.7.0 jinja2-cli[yaml]==0.7.0

View File

@@ -1,10 +1,10 @@
import unittest.mock as mock
from collections import namedtuple from collections import namedtuple
from datetime import datetime, timedelta from datetime import datetime, timedelta
from unittest.mock import call from unittest.mock import call
import pytest import pytest
from freezegun import freeze_time from freezegun import freeze_time
from mock import mock
from app.celery import scheduled_tasks from app.celery import scheduled_tasks
from app.celery.scheduled_tasks import ( from app.celery.scheduled_tasks import (

View File

@@ -1,7 +1,7 @@
import unittest.mock as mock
from datetime import date, datetime, time, timedelta from datetime import date, datetime, time, timedelta
from uuid import UUID from uuid import UUID
import mock
import pytest import pytest
from freezegun import freeze_time from freezegun import freeze_time

View File

@@ -1,8 +1,8 @@
import json import json
import unittest.mock as mock
import uuid import uuid
from datetime import datetime from datetime import datetime
import mock
import pytest import pytest
from flask import current_app, url_for from flask import current_app, url_for
from freezegun import freeze_time from freezegun import freeze_time

View File

@@ -222,7 +222,7 @@ def test_post_letter_notification_international_sets_rest_of_world(
'postcode': 'SW1A 1AA', 'postcode': 'SW1A 1AA',
'name': 'Lizzie' 'name': 'Lizzie'
}, },
'Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / , < > ~', 'Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / , < >',
), ),
( (
[LETTER_TYPE, INTERNATIONAL_LETTERS], [LETTER_TYPE, INTERNATIONAL_LETTERS],

View File

@@ -128,5 +128,7 @@ def test_bad_method(app_for_test):
assert response.status_code == 405 assert response.status_code == 405
assert response.get_data(as_text=True) == \ assert response.json == {
'{"message":"The method is not allowed for the requested URL.","result":"error"}\n' "result": "error",
"message": "The method is not allowed for the requested URL."
}