1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 21:45:25 +02:00

chore: bump aiofiles, dotenv, fastapi, pydantic, uvicorn (#1944)

* update aiofiles and dotenv

* bump fastapi and pydantic

* update testclient

* bump ruff and uvicorn
This commit is contained in:
Hayden 2022-12-30 12:44:54 -08:00 committed by GitHub
parent 28cdd485f3
commit d9c39cc1d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 345 additions and 188 deletions

View file

@ -47,7 +47,7 @@ def test_group_invitation_link(api_client: TestClient, unique_user: TestUser, in
# Login as new User
form_data = {"username": registration.email, "password": registration.password}
r = api_client.post(api_routes.auth_token, form_data)
r = api_client.post(api_routes.auth_token, data=form_data)
assert r.status_code == 200
token = r.json().get("access_token")
assert token is not None

View file

@ -13,7 +13,7 @@ def test_user_registration_new_group(api_client: TestClient):
# Login
form_data = {"username": registration.email, "password": registration.password}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 200
token = response.json().get("access_token")
@ -29,7 +29,7 @@ def test_new_user_group_permissions(api_client: TestClient):
# Login
form_data = {"username": registration.email, "password": registration.password}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 200
token = response.json().get("access_token")

View file

@ -89,9 +89,7 @@ def test_recipe_share_tokens_create_and_get_one(
response = api_client.post(api_routes.shared_recipes, json=payload, headers=unique_user.token)
assert response.status_code == 201
response = api_client.get(
api_routes.shared_recipes_item_id(response.json()["id"]), json=payload, headers=unique_user.token
)
response = api_client.get(api_routes.shared_recipes_item_id(response.json()["id"]), headers=unique_user.token)
assert response.status_code == 200
response_data = response.json()

View file

@ -267,7 +267,6 @@ def test_recipe_slug_mismatch(api_client: TestClient, unique_user: TestUser, rec
# try to perform operations on the event using the wrong recipe
event_response = api_client.get(
api_routes.recipes_slug_timeline_events_item_id(invalid_recipe.slug, event.id),
json=new_event_data,
headers=unique_user.token,
)
assert event_response.status_code == 404
@ -281,7 +280,6 @@ def test_recipe_slug_mismatch(api_client: TestClient, unique_user: TestUser, rec
event_response = api_client.delete(
api_routes.recipes_slug_timeline_events_item_id(invalid_recipe.slug, event.id),
json=new_event_data,
headers=unique_user.token,
)
assert event_response.status_code == 404
@ -289,7 +287,6 @@ def test_recipe_slug_mismatch(api_client: TestClient, unique_user: TestUser, rec
# make sure the event still exists and is unmodified
event_response = api_client.get(
api_routes.recipes_slug_timeline_events_item_id(recipe.slug, event.id),
json=new_event_data,
headers=unique_user.token,
)
assert event_response.status_code == 200

View file

@ -13,7 +13,7 @@ def test_failed_login(api_client: TestClient):
settings = get_app_settings()
form_data = {"username": settings.DEFAULT_EMAIL, "password": "WRONG_PASSWORD"}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 401
@ -22,7 +22,7 @@ def test_superuser_login(api_client: TestClient, admin_token):
settings = get_app_settings()
form_data = {"username": settings.DEFAULT_EMAIL, "password": settings.DEFAULT_PASSWORD}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 200
new_token = json.loads(response.text).get("access_token")
@ -48,12 +48,12 @@ def test_user_lockout_after_bad_attemps(api_client: TestClient, unique_user: Tes
for _ in range(settings.SECURITY_MAX_LOGIN_ATTEMPTS):
form_data = {"username": unique_user.email, "password": "bad_password"}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 401
valid_data = {"username": unique_user.email, "password": unique_user.password}
response = api_client.post(api_routes.auth_token, valid_data)
response = api_client.post(api_routes.auth_token, data=valid_data)
assert response.status_code == 423
# Cleanup

View file

@ -18,11 +18,11 @@ def test_password_reset(api_client: TestClient, unique_user: TestUser, casing: s
elif casing == "upper":
cased_email = unique_user.email.upper()
else:
for i, l in enumerate(unique_user.email):
for i, letter in enumerate(unique_user.email):
if i % 2 == 0:
cased_email += l.upper()
cased_email += letter.upper()
else:
cased_email += l.lower()
cased_email += letter.lower()
cased_email
with session_context() as session:
@ -45,7 +45,7 @@ def test_password_reset(api_client: TestClient, unique_user: TestUser, casing: s
# Test Login
form_data = {"username": unique_user.email, "password": new_password}
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 200
# Test Token

View file

@ -6,7 +6,7 @@ from tests.utils import api_routes
def login(form_data, api_client: TestClient):
response = api_client.post(api_routes.auth_token, form_data)
response = api_client.post(api_routes.auth_token, data=form_data)
assert response.status_code == 200
token = json.loads(response.text).get("access_token")
return {"Authorization": f"Bearer {token}"}