Skip to content

Commit

Permalink
CZID-8317 Update httpx to 0.23.0 (#1668)
Browse files Browse the repository at this point in the history
* Update httpx to 0.23.0

* Update boto3 and botocore.

* Add pytz-deprecation-shim

* follow_redirects for failed tests

* gisaid test sample.location as None instead of empty string

---------

Co-authored-by: phoenixAja <plogan@chanzuckerberg>
  • Loading branch information
ehoops-cz and phoenixAja authored Sep 13, 2023
1 parent 5037ecf commit 2b978f0
Show file tree
Hide file tree
Showing 7 changed files with 500 additions and 443 deletions.
14 changes: 7 additions & 7 deletions src/backend/aspen/api/views/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ async def test_callback_syncs_auth0_user_roles(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 307
assert auth0_apiclient.get_user_orgs.call_count == 1 # type: ignore
Expand All @@ -285,7 +285,7 @@ async def test_callback_doesnt_sync_localdev_roles(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 307
assert auth0_apiclient.get_user_orgs.call_count == 0 # type: ignore
Expand Down Expand Up @@ -315,7 +315,7 @@ async def test_callback_ff_doesnt_sync_auth0_user_roles(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 307
assert auth0_apiclient.get_user_orgs.call_count == 0 # type: ignore
Expand All @@ -340,7 +340,7 @@ async def test_callback_error_redirects(
):
res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
params={"error_description": "invitation not found or already used"},
)
assert res.status_code == 307
Expand All @@ -349,7 +349,7 @@ async def test_callback_error_redirects(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
params={"error_description": "expired"},
)
assert res.status_code == 307
Expand Down Expand Up @@ -387,7 +387,7 @@ async def test_redirect_to_samples_if_exists(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 307
assert auth0_apiclient.get_user_orgs.call_count == 0 # type: ignore
Expand Down Expand Up @@ -422,7 +422,7 @@ async def test_redirect_to_group_welcome_if_new(

res = await http_client.get(
"/v2/auth/callback",
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 307
assert res.is_redirect
Expand Down
2 changes: 1 addition & 1 deletion src/backend/aspen/api/views/tests/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@


async def test_healthcheck(http_client: AsyncClient) -> None:
response = await http_client.get("/v2/health")
response = await http_client.get("/v2/health", follow_redirects=True)
assert response.status_code == 200
assert response.json() == {"healthy": True}
12 changes: 6 additions & 6 deletions src/backend/aspen/api/views/tests/test_invitation_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def make_login_request(
"/v2/auth/login",
params=login_params,
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
return res

Expand Down Expand Up @@ -264,7 +264,7 @@ async def test_callback_redirect(
res = await http_client.get(
"/v2/auth/callback",
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
assert "process_invitation" in res.headers["Location"]
_, _, path, _, query, _ = urlparse(res.headers["Location"])
Expand Down Expand Up @@ -306,7 +306,7 @@ async def test_process_invitation_success(
"/v2/auth/process_invitation",
params=login_params,
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
auth0_org = {"id": group.auth0_org_id, "display_name": "", "name": ""}
auth0_apiclient.add_org_member.assert_called_once_with( # type: ignore
Expand Down Expand Up @@ -353,7 +353,7 @@ async def test_process_invitation_failures(
"/v2/auth/process_invitation",
params=login_params,
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 400

Expand All @@ -368,7 +368,7 @@ async def test_process_invitation_failures(
"/v2/auth/process_invitation",
params=login_params,
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
assert res.headers["Location"] == "/v2/auth/callback"
redirect_kwargs = auth0_oauth.authorize_redirect.call_args.kwargs
Expand All @@ -386,6 +386,6 @@ async def test_process_invitation_failures(
"/v2/auth/process_invitation",
params=login_params,
headers=auth_headers,
allow_redirects=False,
follow_redirects=False,
)
assert res.status_code == 401
3 changes: 3 additions & 0 deletions src/backend/aspen/api/views/tests/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ async def test_update_samples_success(
f"/v2/orgs/{group_id}/pathogens/{pathogen_slug}/samples",
json=request_data,
headers=auth_headers,
follow_redirects=True,
)
api_response = {row["id"]: row for row in res.json()["samples"]}

Expand Down Expand Up @@ -1205,6 +1206,7 @@ async def test_update_samples_access_denied(
f"/v2/orgs/{group.id}/pathogens/{pathogen.slug}/samples",
json=data,
headers=auth_headers,
follow_redirects=True,
)
assert res.status_code == 404

Expand Down Expand Up @@ -1309,6 +1311,7 @@ async def test_update_samples_request_failures(
f"/v2/orgs/{group.id}/pathogens/{pathogen.slug}/samples",
json=data,
headers=auth_headers,
follow_redirects=True,
)
assert res.status_code == response_code

Expand Down
2 changes: 1 addition & 1 deletion src/backend/pipeline_tests/test_gisaid_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_public_repo_db_objects_were_created(session):
assert sample.region == "North America"
assert sample.country == "USA"
assert sample.division == "Texas"
assert sample.location == ""
assert sample.location == None # noqa: E711
# TODO - I have no idea how this ISL is fetched by ncov-ingest
assert sample.isl == "EPI_ISL_4630413"

Expand Down
Loading

0 comments on commit 2b978f0

Please sign in to comment.