Fix dependency issues

We haven't bumped the test version for a while.
Also bumped the version of Flask and itsdangerous.
In order to fix flask warnings I needed to changed how the blueprints were registerd.
This commit is contained in:
Rebecca Law
2021-05-25 16:42:06 +01:00
parent f66f0a2e2d
commit 50de85988e
6 changed files with 40 additions and 60 deletions

View File

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

View File

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

View File

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

View File

@@ -10,12 +10,12 @@ Flask-Bcrypt==0.7.1
flask-marshmallow==0.14.0
Flask-Migrate==2.7.0
git+https://github.com/mitsuhiko/flask-sqlalchemy.git@500e732dd1b975a56ab06a46bd1a20a21e682262#egg=Flask-SQLAlchemy==2.3.2.dev20190108
Flask==1.1.2
Flask==2.0.1
click-datetime==0.2
eventlet==0.30.2 # pyup: ignore # 0.31 breaks Gunicorn
gunicorn==20.1.0
iso8601==0.1.14
itsdangerous==1.1.0
itsdangerous==2.0.1
jsonschema==3.2.0
marshmallow-sqlalchemy==0.23.1 # pyup: <0.24.0 # marshmallow v3 throws errors
marshmallow==2.21.0 # pyup: <3 # v3 throws errors
@@ -36,30 +36,29 @@ notifications-python-client==6.0.2
# PaaS
awscli-cwlogs==1.4.6
git+https://github.com/alphagov/notifications-utils.git@44.2.1#egg=notifications-utils==44.2.1
git+https://github.com/alphagov/notifications-utils.git@44.2.2#egg=notifications-utils==44.2.2
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.10.1
gds-metrics==0.2.4
## The following requirements were added by pip freeze:
alembic==1.6.3
alembic==1.6.4
amqp==1.4.9
anyjson==0.3.3
attrs==21.2.0
awscli==1.19.78
awscli==1.19.82
bcrypt==3.2.0
billiard==3.3.0.23
bleach==3.3.0
blinker==1.4
boto==2.49.0
boto3==1.17.78
botocore==1.20.78
boto3==1.17.82
botocore==1.20.82
certifi==2020.12.5
chardet==4.0.0
click==8.0.1
colorama==0.4.3
dataclasses==0.8
dnspython==1.16.0
docutils==0.15.2
flask-redis==0.4.0
@@ -67,7 +66,6 @@ geojson==2.5.0
govuk-bank-holidays==0.8
greenlet==1.1.0
idna==2.10
importlib-metadata==4.0.1
Jinja2==3.0.1
jmespath==0.10.0
kombu==3.0.37
@@ -96,8 +94,6 @@ six==1.16.0
smartypants==2.0.1
soupsieve==2.2.1
statsd==3.3.0
typing-extensions==3.10.0.0
urllib3==1.26.4
urllib3==1.26.5
webencodings==0.5.1
Werkzeug==2.0.1
zipp==3.4.1

View File

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

View File

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