Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass auth_config through to ContentFetcherTask #222

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hrodmn
Copy link
Contributor

@hrodmn hrodmn commented Oct 28, 2022

This makes it possible to pass API headers from a QgsAuthMethodConfig to pystac_client.Client.open. To do this right we would definitely want a more thorough treatment of alternative authentication options but I just want to put it out here for others to look at.

This resolves #206 and starts us on the path towards #207 .

makes it possible to pass API headers to pystac_client
@Samweli
Copy link
Collaborator

Samweli commented Nov 1, 2022

Hi @hrodmn, thanks so much for your contribution. It would have been nice to have support for all available QGIS authentication methods, but it is great to see you have at least covered one of them.
I was thinking to solve this we might need to propose changes to the pystac-client library to make it accomodate the QGIS authentication system.
Can you check why https://github.com/stac-utils/qgis-stac-plugin/actions/runs/3348157404/jobs/5565825241 is failing? and see if you run tests locally they all pass.

@hrodmn
Copy link
Contributor Author

hrodmn commented Nov 1, 2022

@Samweli I modified the run_tests.sh script a little bit and ran the tests on all of the versions that run in this package's CI:

#!/usr/bin/env bash

QGIS_IMAGE=qgis/qgis

QGIS_IMAGE_V_3_16=release-3_16
QGIS_IMAGE_V_3_20=release-3_20
QGIS_IMAGE_V_3_22=release-3_22
QGIS_IMAGE_V_3_24=release-3_24
QGIS_IMAGE_V_3_26=final-3_26_0

QGIS_VERSION_TAGS=($QGIS_IMAGE_V_3_16 $QGIS_IMAGE_V_3_20 $QGIS_IMAGE_V_3_22 $QGIS_IMAGE_V_3_24 $QGIS_IMAGE_V_3_26)

export IMAGE=$QGIS_IMAGE
export WITH_PYTHON_PEP=false
export ON_TRAVIS=false
export MUTE_LOGS=true

for TAG in "${QGIS_VERSION_TAGS[@]}"
do
    echo "Running tests for QGIS $TAG"
    export QGIS_VERSION_TAG=$TAG
    docker compose up -d
    sleep 10
    docker compose exec -T qgis-testing-environment sh -c "pip3 install flask"
    docker compose exec -T qgis-testing-environment qgis_testrunner.sh test_suite.test_package
    docker compose down
done

The tests pass for all of the versions except 3.22, but this may be expected because apparently that image was pushed from a failed build! See qgis/QGIS#50729 for details.

Here is the test output:

Running tests for QGIS release-3_16
Collecting flask
  Downloading Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting click>=8.0
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
Collecting Werkzeug>=2.2.2
  Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Requirement already satisfied: importlib-metadata>=3.6.0; python_version < "3.10" in /usr/local/lib/python3.8/dist-packages (from flask) (4.11.3)
Collecting itsdangerous>=2.0
  Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.8/dist-packages (from flask) (3.1.1)
Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.8/dist-packages (from Werkzeug>=2.2.2->flask) (2.1.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.8/dist-packages (from importlib-metadata>=3.6.0; python_version < "3.10"->flask) (3.8.0)
Installing collected packages: click, Werkzeug, itsdangerous, flask
Successfully installed Werkzeug-2.2.2 click-8.1.3 flask-2.2.2 itsdangerous-2.1.2
Running test test_suite.test_package ...
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
QGIS Test Runner Inside - starting the tests ...
QGIS Test Runner - Trying to import test_suite.test_package
QGIS Test Runner - Trying to import test_suite
QGIS Test Runner Inside - executing function <function test_package at 0x7f0793c98790>
########
9 tests has been discovered in test
QGIS : 31616
Python GDAL : 3000400
QT : 5.12.8
Run slow tests : False
########
test_read_init (test_init.TestInit)
Test that the plugin __init__ will validate on plugins.qgis.org. ... ok
test_projection (test_qgis_environment.QGISTest)
Test that QGIS properly parses a wkt string. ... ok
test_qgis_environment (test_qgis_environment.QGISTest)
QGIS environment has the expected providers ... ok
test_connection_settings (test_settings_manager.SettingsManagerTest)
Connection settings can be added, edited and removed ... ok
test_read_write_settings (test_settings_manager.SettingsManagerTest)
Settings manager can store and retrieve settings ... ok
test_collections_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections HTTP/1.1" 200 -
ok
test_conformance_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET / HTTP/1.1" 200 -
ok
test_items_sort (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
ok
test_resources_fetch (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:40:45] "GET /collections/simple-collection HTTP/1.1" 200 -
ok

----------------------------------------------------------------------
Ran 9 tests in 0.530s

OK
Finished running test test_suite.test_package (codes: IS_DEAD=1 IS_FAILED=1 IS_PASSED=0).
Running tests for QGIS release-3_20
Collecting flask
  Downloading Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting Werkzeug>=2.2.2
  Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.8/dist-packages (from flask) (3.0.2)
Collecting importlib-metadata>=3.6.0; python_version < "3.10"
  Downloading importlib_metadata-5.0.0-py3-none-any.whl (21 kB)
Collecting click>=8.0
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
Collecting itsdangerous>=2.0
  Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting MarkupSafe>=2.1.1
  Downloading MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting zipp>=0.5
  Downloading zipp-3.10.0-py3-none-any.whl (6.2 kB)
Installing collected packages: MarkupSafe, Werkzeug, zipp, importlib-metadata, click, itsdangerous, flask
  Attempting uninstall: MarkupSafe
    Found existing installation: MarkupSafe 2.0.1
    Uninstalling MarkupSafe-2.0.1:
      Successfully uninstalled MarkupSafe-2.0.1
Successfully installed MarkupSafe-2.1.1 Werkzeug-2.2.2 click-8.1.3 flask-2.2.2 importlib-metadata-5.0.0 itsdangerous-2.1.2 zipp-3.10.0
Running test test_suite.test_package ...
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
QGIS Test Runner Inside - starting the tests ...
QGIS Test Runner - Trying to import test_suite.test_package
QGIS Test Runner - Trying to import test_suite
QGIS Test Runner Inside - executing function <function test_package at 0x7ff4431c28b0>
########
9 tests has been discovered in test
QGIS : 32003
Python GDAL : 3000400
QT : 5.12.8
Run slow tests : False
########
test_read_init (test_init.TestInit)
Test that the plugin __init__ will validate on plugins.qgis.org. ... ok
test_projection (test_qgis_environment.QGISTest)
Test that QGIS properly parses a wkt string. ... ok
test_qgis_environment (test_qgis_environment.QGISTest)
QGIS environment has the expected providers ... ok
test_connection_settings (test_settings_manager.SettingsManagerTest)
Connection settings can be added, edited and removed ... ok
test_read_write_settings (test_settings_manager.SettingsManagerTest)
Settings manager can store and retrieve settings ... ok
test_collections_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections HTTP/1.1" 200 -
ok
test_conformance_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET / HTTP/1.1" 200 -
ok
test_items_sort (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
ok
test_resources_fetch (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:41:26] "GET /collections/simple-collection HTTP/1.1" 200 -
ok

----------------------------------------------------------------------
Ran 9 tests in 0.500s

OK
Finished running test test_suite.test_package (codes: IS_DEAD=1 IS_FAILED=1 IS_PASSED=0).
Running tests for QGIS release-3_22
Running tests for QGIS release-3_24
Collecting flask
  Downloading Flask-2.2.2-py3-none-any.whl (101 kB)
Requirement already satisfied: importlib-metadata>=3.6.0; python_version < "3.10" in /usr/local/lib/python3.8/dist-packages (from flask) (4.12.0)
Collecting click>=8.0
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.8/dist-packages (from flask) (3.1.2)
Collecting itsdangerous>=2.0
  Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting Werkzeug>=2.2.2
  Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.8/dist-packages (from importlib-metadata>=3.6.0; python_version < "3.10"->flask) (3.8.1)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.8/dist-packages (from Jinja2>=3.0->flask) (2.1.1)
Installing collected packages: click, itsdangerous, Werkzeug, flask
Successfully installed Werkzeug-2.2.2 click-8.1.3 flask-2.2.2 itsdangerous-2.1.2
Running test test_suite.test_package ...
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
QGIS Test Runner Inside - starting the tests ...
QGIS Test Runner - Trying to import test_suite.test_package
QGIS Test Runner - Trying to import test_suite
QGIS Test Runner Inside - executing function <function test_package at 0x7f2e649f9940>
########
9 tests has been discovered in test
QGIS : 32403
Python GDAL : 3000400
QT : 5.12.8
Run slow tests : False
########
test_read_init (test_init.TestInit)
Test that the plugin __init__ will validate on plugins.qgis.org. ... ok
test_projection (test_qgis_environment.QGISTest)
Test that QGIS properly parses a wkt string. ... ok
test_qgis_environment (test_qgis_environment.QGISTest)
QGIS environment has the expected providers ... ok
test_connection_settings (test_settings_manager.SettingsManagerTest)
Connection settings can be added, edited and removed ... ok
test_read_write_settings (test_settings_manager.SettingsManagerTest)
Settings manager can store and retrieve settings ... ok
test_collections_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections HTTP/1.1" 200 -
ok
test_conformance_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET / HTTP/1.1" 200 -
ok
test_items_sort (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
ok
test_resources_fetch (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:20] "GET /collections/simple-collection HTTP/1.1" 200 -
ok

----------------------------------------------------------------------
Ran 9 tests in 0.526s

OK
Finished running test test_suite.test_package (codes: IS_DEAD=1 IS_FAILED=1 IS_PASSED=0).
Running tests for QGIS final-3_26_0
Collecting flask
  Downloading Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting itsdangerous>=2.0
  Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.8/dist-packages (from flask) (3.1.2)
Requirement already satisfied: importlib-metadata>=3.6.0; python_version < "3.10" in /usr/local/lib/python3.8/dist-packages (from flask) (4.11.4)
Collecting Werkzeug>=2.2.2
  Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Collecting click>=8.0
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.8/dist-packages (from Jinja2>=3.0->flask) (2.1.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.8/dist-packages (from importlib-metadata>=3.6.0; python_version < "3.10"->flask) (3.8.0)
Installing collected packages: itsdangerous, Werkzeug, click, flask
Successfully installed Werkzeug-2.2.2 click-8.1.3 flask-2.2.2 itsdangerous-2.1.2
Running test test_suite.test_package ...
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
ERROR: Status 2: File /tests_directory/test_suite.test_package could not be found
QGIS Test Runner Inside - starting the tests ...
QGIS Test Runner - Trying to import test_suite.test_package
QGIS Test Runner - Trying to import test_suite
QGIS Test Runner Inside - executing function <function test_package at 0x7f76b7c22310>
########
9 tests has been discovered in test
QGIS : 32600
Python GDAL : 3000400
QT : 5.12.8
Run slow tests : False
########
test_read_init (test_init.TestInit)
Test that the plugin __init__ will validate on plugins.qgis.org. ... ok
test_projection (test_qgis_environment.QGISTest)
Test that QGIS properly parses a wkt string. ... ok
test_qgis_environment (test_qgis_environment.QGISTest)
QGIS environment has the expected providers ... ok
test_connection_settings (test_settings_manager.SettingsManagerTest)
Connection settings can be added, edited and removed ... ok
test_read_write_settings (test_settings_manager.SettingsManagerTest)
Settings manager can store and retrieve settings ... ok
test_collections_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET /collections HTTP/1.1" 200 -
ok
test_conformance_search (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET / HTTP/1.1" 200 -
ok
test_items_sort (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:59] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:42:59] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
ok
test_resources_fetch (test_stac_api_client.STACApiClientTest) ...  * Serving Flask app 'mock.stac_api_server_app'
 * Debug mode: off
�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
 * Running on http://127.0.0.1:5000
�[33mPress CTRL+C to quit�[0m
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "POST /search HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
127.0.0.1 - - [01/Nov/2022 19:43:00] "GET /collections/simple-collection HTTP/1.1" 200 -
ok

----------------------------------------------------------------------
Ran 9 tests in 0.516s

OK
Finished running test test_suite.test_package (codes: IS_DEAD=1 IS_FAILED=1 IS_PASSED=0).

@Samweli
Copy link
Collaborator

Samweli commented Nov 2, 2022

@Samweli I modified the run_tests.sh script a little bit and ran the tests on all of the versions that run in this package's CI:

Cool @hrodmn, I'm currently testing the PR functionality locally to see is if it works will get back to you after that, thanks.

@hrodmn
Copy link
Contributor Author

hrodmn commented Nov 2, 2022

Sounds good, @Samweli. I want to add a unit test case with a mock server that requires authentication. I am trying to work out a solution there but need to get up to speed on flask. Based on this post it looks like it shouldn't be too hard to mock up a header-based authentication scheme: https://blog.ruanbekker.com/blog/2018/06/01/add-a-authentication-header-to-your-python-flask-app/

@randyberos
Copy link

Hello, is there any plan on when this will be merged to a new release of the plugin? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

APIHeader authentication does not work and prints an error message that is not useful
3 participants