From 90dc184fe74ba5510499b8357bca260477be0d7b Mon Sep 17 00:00:00 2001 From: Kieron Taylor Date: Tue, 13 Dec 2022 15:16:46 +0000 Subject: [PATCH 1/2] Newer starlette releases require httpx, and redirect handling has changed --- setup.py | 4 +++- tests/pipeline_route_test.py | 10 +++++----- tests/task_route_test.py | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index a245010..1aa60ed 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,7 @@ 'pydantic', 'pysqlite3', 'psycopg2-binary', + 'starlette>=0.22.0', 'sqlalchemy>=1.4.29', 'ujson', 'uvicorn', @@ -34,7 +35,8 @@ 'pytest', 'pytest-asyncio', 'requests', - 'flake8' + 'flake8', + 'httpx' ] } ) diff --git a/tests/pipeline_route_test.py b/tests/pipeline_route_test.py index 702ad27..7d3502e 100644 --- a/tests/pipeline_route_test.py +++ b/tests/pipeline_route_test.py @@ -16,18 +16,18 @@ def http_create_pipeline(fastapi_testclient, pipeline): response = fastapi_testclient.post( - '/pipelines', json=pipeline.dict(), allow_redirects=True + '/pipelines', json=pipeline.dict(), follow_redirects=True ) assert response.status_code == status.HTTP_403_FORBIDDEN response = fastapi_testclient.post( - '/pipelines', json=pipeline.dict(), allow_redirects=True, + '/pipelines', json=pipeline.dict(), follow_redirects=True, headers=headers ) assert response.status_code == status.HTTP_403_FORBIDDEN response = fastapi_testclient.post( - '/pipelines', json=pipeline.dict(), allow_redirects=True, + '/pipelines', json=pipeline.dict(), follow_redirects=True, headers=headers4power_user ) assert response.status_code == status.HTTP_201_CREATED @@ -116,7 +116,7 @@ def test_create_pipeline(async_minimum, fastapi_testclient): response = fastapi_testclient.post( '/pipelines', json=desired_pipeline.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4power_user ) assert response.status_code == status.HTTP_409_CONFLICT, 'ptest two already in DB' @@ -148,7 +148,7 @@ def test_create_pipeline(async_minimum, fastapi_testclient): response = fastapi_testclient.post( '/pipelines', json=third_desired_pipeline.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4power_user ) assert response.status_code == status.HTTP_400_BAD_REQUEST diff --git a/tests/task_route_test.py b/tests/task_route_test.py index 54fccd1..b33cf97 100644 --- a/tests/task_route_test.py +++ b/tests/task_route_test.py @@ -28,7 +28,7 @@ def test_task_creation(async_minimum, fastapi_testclient): response = fastapi_testclient.post( 'tasks', json=task_one.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_201_CREATED @@ -38,7 +38,7 @@ def test_task_creation(async_minimum, fastapi_testclient): response = fastapi_testclient.post( 'tasks', json=task_one.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_409_CONFLICT @@ -56,7 +56,7 @@ def test_task_creation(async_minimum, fastapi_testclient): response = fastapi_testclient.post( 'tasks', json=task_two.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_403_FORBIDDEN @@ -71,7 +71,7 @@ def test_task_update(async_minimum, fastapi_testclient): response = fastapi_testclient.put( '/tasks', json=task, - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_200_OK @@ -86,7 +86,7 @@ def test_task_update(async_minimum, fastapi_testclient): response = fastapi_testclient.put( '/tasks', json=modified_task.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_404_NOT_FOUND @@ -101,7 +101,7 @@ def test_task_update(async_minimum, fastapi_testclient): response = fastapi_testclient.put( '/tasks', json=modified_task.dict(), - allow_redirects=True, + follow_redirects=True, headers=headers4ptest_one ) assert response.status_code == status.HTTP_403_FORBIDDEN From cfab67a458ab65ef004ae169a66ea2e2348a3f12 Mon Sep 17 00:00:00 2001 From: Keith James <47220353+kjsanger@users.noreply.github.com> Date: Fri, 16 Dec 2022 12:42:38 +0000 Subject: [PATCH 2/2] Move from checkout@v2 to @v3 --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 98485d9..041de38 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python 3.10 uses: actions/setup-python@v2 with: