1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00

chore(deps): update dependency ruff to ^0.9.0 (#4871)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2025-01-13 15:43:55 +00:00 committed by GitHub
parent ea0bec2336
commit 2c2de1e95b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 124 additions and 138 deletions

View file

@ -1,5 +1,5 @@
import random
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
from uuid import UUID
from fastapi.testclient import TestClient
@ -42,11 +42,11 @@ def create_rule(
):
qf_parts: list[str] = []
if tags:
qf_parts.append(f'tags.id CONTAINS ALL [{",".join([str(tag.id) for tag in tags])}]')
qf_parts.append(f"tags.id CONTAINS ALL [{','.join([str(tag.id) for tag in tags])}]")
if categories:
qf_parts.append(f'recipe_category.id CONTAINS ALL [{",".join([str(cat.id) for cat in categories])}]')
qf_parts.append(f"recipe_category.id CONTAINS ALL [{','.join([str(cat.id) for cat in categories])}]")
if households:
qf_parts.append(f'household_id IN [{",".join([str(household.id) for household in households])}]')
qf_parts.append(f"household_id IN [{','.join([str(household.id) for household in households])}]")
query_filter_string = " AND ".join(qf_parts)
return unique_user.repos.group_meal_plan_rules.create(
@ -64,9 +64,9 @@ def test_create_mealplan_no_recipe(api_client: TestClient, unique_user: TestUser
title = random_string(length=25)
text = random_string(length=25)
new_plan = CreatePlanEntry(
date=datetime.now(timezone.utc).date(), entry_type="breakfast", title=title, text=text
date=datetime.now(UTC).date(), entry_type="breakfast", title=title, text=text
).model_dump()
new_plan["date"] = datetime.now(timezone.utc).date().strftime("%Y-%m-%d")
new_plan["date"] = datetime.now(UTC).date().strftime("%Y-%m-%d")
response = api_client.post(api_routes.households_mealplans, json=new_plan, headers=unique_user.token)
@ -86,10 +86,10 @@ def test_create_mealplan_with_recipe(api_client: TestClient, unique_user: TestUs
recipe = response.json()
recipe_id = recipe["id"]
new_plan = CreatePlanEntry(
date=datetime.now(timezone.utc).date(), entry_type="dinner", recipe_id=recipe_id
).model_dump(by_alias=True)
new_plan["date"] = datetime.now(timezone.utc).date().strftime("%Y-%m-%d")
new_plan = CreatePlanEntry(date=datetime.now(UTC).date(), entry_type="dinner", recipe_id=recipe_id).model_dump(
by_alias=True
)
new_plan["date"] = datetime.now(UTC).date().strftime("%Y-%m-%d")
new_plan["recipeId"] = str(recipe_id)
response = api_client.post(api_routes.households_mealplans, json=new_plan, headers=unique_user.token)
@ -101,14 +101,14 @@ def test_create_mealplan_with_recipe(api_client: TestClient, unique_user: TestUs
def test_crud_mealplan(api_client: TestClient, unique_user: TestUser):
new_plan = CreatePlanEntry(
date=datetime.now(timezone.utc).date(),
date=datetime.now(UTC).date(),
entry_type="breakfast",
title=random_string(),
text=random_string(),
).model_dump()
# Create
new_plan["date"] = datetime.now(timezone.utc).date().strftime("%Y-%m-%d")
new_plan["date"] = datetime.now(UTC).date().strftime("%Y-%m-%d")
response = api_client.post(api_routes.households_mealplans, json=new_plan, headers=unique_user.token)
response_json = response.json()
assert response.status_code == 201
@ -139,13 +139,13 @@ def test_crud_mealplan(api_client: TestClient, unique_user: TestUser):
def test_get_all_mealplans(api_client: TestClient, unique_user: TestUser):
for _ in range(3):
new_plan = CreatePlanEntry(
date=datetime.now(timezone.utc).date(),
date=datetime.now(UTC).date(),
entry_type="breakfast",
title=random_string(),
text=random_string(),
).model_dump()
new_plan["date"] = datetime.now(timezone.utc).date().strftime("%Y-%m-%d")
new_plan["date"] = datetime.now(UTC).date().strftime("%Y-%m-%d")
response = api_client.post(api_routes.households_mealplans, json=new_plan, headers=unique_user.token)
assert response.status_code == 201
@ -159,7 +159,7 @@ def test_get_all_mealplans(api_client: TestClient, unique_user: TestUser):
def test_get_slice_mealplans(api_client: TestClient, unique_user: TestUser):
# Make List of 10 dates from now to +10 days
dates = [datetime.now(timezone.utc).date() + timedelta(days=x) for x in range(10)]
dates = [datetime.now(UTC).date() + timedelta(days=x) for x in range(10)]
# Make a list of 10 meal plans
meal_plans = [
@ -193,7 +193,7 @@ def test_get_mealplan_today(api_client: TestClient, unique_user: TestUser):
# Create Meal Plans for today
test_meal_plans = [
CreatePlanEntry(
date=datetime.now(timezone.utc).date(), entry_type="breakfast", title=random_string(), text=random_string()
date=datetime.now(UTC).date(), entry_type="breakfast", title=random_string(), text=random_string()
).model_dump()
for _ in range(3)
]
@ -212,7 +212,7 @@ def test_get_mealplan_today(api_client: TestClient, unique_user: TestUser):
response_json = response.json()
for meal_plan in response_json:
assert meal_plan["date"] == datetime.now(timezone.utc).date().strftime("%Y-%m-%d")
assert meal_plan["date"] == datetime.now(UTC).date().strftime("%Y-%m-%d")
def test_get_mealplan_with_rules_categories_and_tags_filter(api_client: TestClient, unique_user: TestUser):

View file

@ -1,4 +1,4 @@
from datetime import datetime, timezone
from datetime import UTC, datetime
import pytest
from fastapi.testclient import TestClient
@ -14,7 +14,7 @@ def webhook_data():
"name": "Test-Name",
"url": "https://my-fake-url.com",
"time": "00:00",
"scheduledTime": datetime.now(timezone.utc),
"scheduledTime": datetime.now(UTC),
}
@ -41,7 +41,7 @@ def test_read_webhook(api_client: TestClient, unique_user: TestUser, webhook_dat
assert webhook["id"] == item_id
assert webhook["name"] == webhook_data["name"]
assert webhook["url"] == webhook_data["url"]
assert webhook["scheduledTime"] == str(webhook_data["scheduledTime"].astimezone(timezone.utc).time())
assert webhook["scheduledTime"] == str(webhook_data["scheduledTime"].astimezone(UTC).time())
assert webhook["enabled"] == webhook_data["enabled"]

View file

@ -6,7 +6,6 @@ import sqlalchemy
from fastapi.testclient import TestClient
from mealie.core.dependencies.dependencies import validate_file_token
from mealie.repos.repository_factory import AllRepositories
from mealie.schema.recipe.recipe_bulk_actions import ExportTypes
from mealie.schema.recipe.recipe_category import CategorySave, TagSave
from tests import utils
@ -137,7 +136,7 @@ def test_bulk_export_recipes(api_client: TestClient, unique_user: TestUser, ten_
assert validate_file_token(response_data["fileToken"]) == Path(export_path)
# Use Export Token to download export
response = api_client.get(f'/api/utils/download?token={response_data["fileToken"]}')
response = api_client.get(f"/api/utils/download?token={response_data['fileToken']}")
assert response.status_code == 200

View file

@ -1,4 +1,4 @@
from datetime import datetime, timezone
from datetime import UTC, datetime
import pytest
from fastapi.testclient import TestClient
@ -242,7 +242,7 @@ def test_user_can_update_last_made_on_other_household(
assert recipe["id"] == str(h2_recipe_id)
old_last_made = recipe["lastMade"]
now = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
now = datetime.now(UTC).isoformat().replace("+00:00", "Z")
response = api_client.patch(
api_routes.recipes_slug_last_made(h2_recipe_slug), json={"timestamp": now}, headers=unique_user.token
)

View file

@ -1,4 +1,4 @@
from datetime import datetime, timezone
from datetime import UTC, datetime
from fastapi.testclient import TestClient
@ -106,7 +106,7 @@ def test_user_update_last_made(api_client: TestClient, user_tuple: list[TestUser
response = api_client.put(api_routes.recipes + f"/{recipe_name}", json=recipe, headers=usr_1.token)
# User 2 should be able to update the last made timestamp
last_made_json = {"timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")}
last_made_json = {"timestamp": datetime.now(UTC).isoformat().replace("+00:00", "Z")}
response = api_client.patch(
api_routes.recipes_slug_last_made(recipe_name), json=last_made_json, headers=usr_2.token
)