diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c76fb165..eb57329f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: # Set up postgres services: postgres: - image: postgres:9.6 + image: postgres:13.13 env: POSTGRES_PASSWORD: password POSTGRES_USER: postgres @@ -26,21 +26,19 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - # Set up Python 3.7 - - name: Set up Python 3.7 + # Set up Python 3.9 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: "3.9" # Install EMMAA/test dependencies - name: Install dependencies run: | sudo apt-get install libpq-dev psql --no-password -h localhost -c 'create database emmaadb_test;' -U postgres - wget -nv https://files.pythonhosted.org/packages/91/a1/55b8224cbc9986bbad4b8f0f2dd11892845156b759b3495202d457ca0b73/kappy-4.0.94-cp37-cp37m-manylinux2010_x86_64.whl - mv kappy-4.0.94-cp37-cp37m-manylinux2010_x86_64.whl kappy-4.0.94-cp37-cp37m-manylinux2010_x86_64.zip - unzip kappy-4.0.94-cp37-cp37m-manylinux2010_x86_64.zip sudo apt-get install graphviz libgraphviz-dev pkg-config python -m pip install --upgrade pip + pip install kappy==4.1.2 pip install nose coverage flask pyyaml boto3 openpyxl pip install git+https://github.com/sorgerlab/indra.git pip uninstall -y enum34 @@ -60,7 +58,7 @@ jobs: # cd automates # git checkout claytonm/gromet # cd .. - pip install boto3 jsonpickle pygraphviz fnvhash inflection pybel==0.15 flask_jwt_extended==3.25.0 gilda tweepy nose coverage moto[iam] sqlalchemy_utils termcolor flask-cors + pip install boto3 jsonpickle pygraphviz fnvhash inflection pybel==0.15 flask_jwt_extended==4.6.0 gilda tweepy nose coverage 'moto[iam]<5' sqlalchemy_utils termcolor flask-cors==4.0.1 pip install --no-dependencies . pip install -U sqlalchemy==1.3.23 wget "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.4.0/BioNetGen-2.4.0-Linux.tgz" -O bionetgen.tar.gz -nv diff --git a/emmaa/tests/test_xdd.py b/emmaa/tests/test_xdd.py index 7371e714..e642427f 100644 --- a/emmaa/tests/test_xdd.py +++ b/emmaa/tests/test_xdd.py @@ -4,11 +4,11 @@ @attr('nonpublic') def test_document_figures_doi(): - doi = '10.1016/j.apsb.2020.09.003' + doi = '10.1136/bmj.n436' fig_list = get_document_figures(doi, 'DOI') assert fig_list # Should be a list of tuples with title and image bytes - assert len(fig_list[0]) == 2 + assert len(fig_list[0]) == 8 # This would call database diff --git a/emmaa_service/api.py b/emmaa_service/api.py index 0c0e9cc8..5031b0d8 100644 --- a/emmaa_service/api.py +++ b/emmaa_service/api.py @@ -13,7 +13,7 @@ from flask_restx import Api, Resource, fields, inputs, abort as restx_abort from flask_cors import CORS -from flask_jwt_extended import jwt_optional +from flask_jwt_extended import jwt_required from urllib import parse from collections import defaultdict, Counter from copy import deepcopy @@ -1146,14 +1146,14 @@ def session_expiration_check(): @app.route('/health') -@jwt_optional +@jwt_required(optional=True) def health(): return jsonify({'status': 'pass'}) @app.route('/') @app.route('/home') -@jwt_optional +@jwt_required(optional=True) def get_home(): loaded = request.args.get('loaded') loaded = (loaded == 'true') @@ -1169,7 +1169,7 @@ def get_home(): @app.route('/dashboard/') -@jwt_optional +@jwt_required(optional=True) def get_model_dashboard(model): """Render model dashboard page.""" loaded = request.args.get('loaded') @@ -1691,7 +1691,7 @@ def get_model_tests_page(model): @app.route('/query') -@jwt_optional +@jwt_required(optional=True) def get_query_page(): """Render queries page.""" loaded = request.args.get('loaded') @@ -1963,7 +1963,7 @@ def get_all_statements_page(model): @app.route('/demos') -@jwt_optional +@jwt_required(optional=True) def get_demos_page(): user, roles = resolve_auth(dict(request.args)) user_email = user.email if user else "" @@ -1972,7 +1972,7 @@ def get_demos_page(): @app.route('/chat') -@jwt_optional +@jwt_required(optional=True) def chat_with_the_model(): model = request.args.get('model', '') user, roles = resolve_auth(dict(request.args)) @@ -2057,7 +2057,7 @@ def get_query_tests_page(model): @app.route('/query/submit', methods=['POST']) -@jwt_optional +@jwt_required(optional=True) def process_query(): """Get result for a query.""" # Print inputs. @@ -2241,7 +2241,7 @@ def email_unsubscribe_post(): @app.route('/subscribe/', methods=['POST']) -@jwt_optional +@jwt_required(optional=True) def model_subscription(model): user, roles = resolve_auth(dict(request.args)) if not roles and not user: @@ -2323,7 +2323,7 @@ def get_statement_by_paper(model, paper_id, paper_id_type, date, hash_val): @app.route('/curation/submit/', methods=['POST']) -@jwt_optional +@jwt_required(optional=True) def submit_curation_endpoint(hash_val, **kwargs): user, roles = resolve_auth(dict(request.args)) if not roles and not user: diff --git a/setup.py b/setup.py index 23cfc1af..09a43a98 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ install_requires=['indra', 'boto3', 'jsonpickle', 'kappy==4.1.2', 'pygraphviz', 'fnvhash', 'sqlalchemy<1.4', 'inflection', 'pybel==0.15', - 'flask_jwt_extended==3.25.0', 'gilda', 'tweepy'], - extras_require={'test': ['nose', 'coverage', 'moto[iam]', + 'flask_jwt_extended', 'gilda', 'tweepy'], + extras_require={'test': ['nose', 'coverage', 'moto[iam]<5', 'sqlalchemy_utils']} )