From af1508ee8daf9ea4e00510ef4ac931baf023837a Mon Sep 17 00:00:00 2001 From: Pauline Ribeyre Date: Mon, 23 Sep 2019 13:52:22 -0500 Subject: [PATCH] Bump flask to 1.1.1 (#661) --- .travis.yml | 6 ------ fence/blueprints/login/redirect.py | 6 +++++- requirements.txt | 4 ++-- setup.py | 4 ++-- tests/data/test_data.py | 24 ++++++++++++------------ tests/link/test_link.py | 4 ++-- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0db64bb13..0396d9ab2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,8 @@ language: python python: - - "2.7" - "3.6" -matrix: - allow_failures: - - python: "2.7" - sudo: false cache: pip @@ -23,7 +18,6 @@ install: - psql -c 'SELECT version();' -U postgres - python setup.py install - psql -U postgres -c "create database fence_test_tmp" - - if [[ $TRAVIS_PYTHON_VERSION != 3.6 ]]; then userdatamodel-init --db fence_test_tmp; fi - pip list before_script: diff --git a/fence/blueprints/login/redirect.py b/fence/blueprints/login/redirect.py index 48b801480..33bbe0d3b 100644 --- a/fence/blueprints/login/redirect.py +++ b/fence/blueprints/login/redirect.py @@ -3,12 +3,16 @@ folder). """ +from cdislogging import get_logger import flask from fence.blueprints.login.utils import allowed_login_redirects, domain from fence.errors import UserError +logger = get_logger(__name__) + + def validate_redirect(url): """ Complain if a given URL is not on the login redirect whitelist. @@ -31,7 +35,7 @@ def validate_redirect(url): """ allowed_redirects = allowed_login_redirects() if domain(url) not in allowed_redirects: - flask.current_app.logger.error( + logger.error( "invalid redirect {}. expected one of: {}".format(url, allowed_redirects) ) raise UserError("invalid login redirect URL {}".format(url)) diff --git a/requirements.txt b/requirements.txt index d57951f51..295a5d8ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ cdiserrors==0.1.2 cdispyutils==1.0.2 cryptography>=2.1.2<3.0 datamodelutils==0.4.5 -Flask==0.12.4 +Flask==1.1.1 Flask-CORS==3.0.3 Flask_OAuthlib==0.9.4 flask-restful==0.3.6 @@ -36,7 +36,7 @@ six==1.11.0 SQLAlchemy==1.3.3 temps==0.3.0 userdatamodel==2.0.1 -Werkzeug==0.12.2 +Werkzeug==0.16.0 pyyaml==5.1 retry==0.9.2 git+https://github.com/uc-cdis/storage-client.git@1.0.0#egg=storageclient diff --git a/setup.py b/setup.py index 52204c346..5c7cd8911 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ "cached_property>=1.5.1,<2.0.0", "cryptography>=2.1.2<3.0", "flask-restful>=0.3.6,<1.0.0", - "Flask>=0.10.1,<1.0.0", + "Flask>=1.1.1,<2.0.0", "Flask-CORS>=3.0.3,<4.0.0", "Flask_OAuthlib>=0.9.4,<1.0.0", "Flask_SQLAlchemy_Session>=1.1,<2.0", @@ -37,7 +37,7 @@ "SQLAlchemy>=1.3.3,<1.4.0", "temps>=0.3.0,<1.0.0", "userdatamodel>=2.0.1,<3.0.0", - "Werkzeug>=0.12.2,<1.0.0", + "Werkzeug>=0.16.0,<1.0.0", "storageclient", "pyyaml~=5.1", ], diff --git a/tests/data/test_data.py b/tests/data/test_data.py index f13746583..6bd9a8b7d 100644 --- a/tests/data/test_data.py +++ b/tests/data/test_data.py @@ -137,8 +137,8 @@ def test_indexd_download_file_no_jwt(client, auth_client): assert response.status_code == 401 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json @pytest.mark.parametrize( @@ -160,8 +160,8 @@ def test_indexd_unauthorized_download_file( assert response.status_code == 401 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json @pytest.mark.parametrize( @@ -219,8 +219,8 @@ def test_unauthorized_indexd_download_file( assert response.status_code == 401 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json mock_index_document.stop() @@ -281,8 +281,8 @@ def test_unauthorized_indexd_upload_file( assert response.status_code == 401 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json mock_index_document.stop() @@ -343,8 +343,8 @@ def test_unavailable_indexd_upload_file( assert response.status_code == 401 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json mock_index_document.stop() @@ -465,8 +465,8 @@ def test_public_bucket_unsupported_protocol_file( assert response.status_code == 400 # response should not be JSON, should be HTML error page - with pytest.raises(ValueError): - response.json + assert response.mimetype == "text/html" + assert not response.json def test_blank_index_upload(app, client, auth_client, encoded_creds_jwt, user_client): diff --git a/tests/link/test_link.py b/tests/link/test_link.py index 8943cccbc..23875f821 100644 --- a/tests/link/test_link.py +++ b/tests/link/test_link.py @@ -308,9 +308,9 @@ def test_patch_google_link( .first() ) # make sure the link is valid for the requested time - # (allow up to 10 sec for runtime) + # (allow up to 15 sec for runtime) diff = account_in_proxy_group.expires - int(time.time()) - assert requested_exp <= diff <= requested_exp + 10 + assert requested_exp <= diff <= requested_exp + 15 def test_patch_google_link_account_not_in_token(