Merge branch 'mealie-next' into feat/standardize-units

This commit is contained in:
Michael Genson
2026-02-25 16:49:13 -06:00
committed by GitHub
53 changed files with 506 additions and 473 deletions

View File

@@ -19,6 +19,7 @@ from recipe_scrapers._schemaorg import SchemaOrg
from recipe_scrapers.plugins import SchemaOrgFillPlugin
from slugify import slugify
from mealie.db.models.recipe import RecipeModel
from mealie.pkgs.safehttp.transport import AsyncSafeTransport
from mealie.schema.cookbook.cookbook import SaveCookBook
from mealie.schema.recipe.recipe import Recipe, RecipeCategory, RecipeSummary, RecipeTag
@@ -1252,6 +1253,25 @@ def test_get_recipe_by_slug_or_id(api_client: TestClient, unique_user: utils.Tes
assert recipe_data["id"] == recipe_id
def test_get_recipe_ingredient_missing_reference_id(api_client: TestClient, unique_user: utils.TestUser):
slug = random_string()
response = api_client.post(api_routes.recipes, json={"name": slug}, headers=unique_user.token)
assert response.status_code == 201
# Manually edit the database to remove the reference id from the ingredient
session = unique_user.repos.session
recipe = session.query(RecipeModel).filter(RecipeModel.slug == slug).first()
recipe.recipe_ingredient[0].reference_id = None
session.commit()
# Make sure we can fetch the recipe and generate a new reference id
response = api_client.get(api_routes.recipes_slug(slug), headers=unique_user.token)
assert response.status_code == 200
recipe_data = response.json()
assert len(recipe_data["recipeIngredient"]) == 1
assert recipe_data["recipeIngredient"][0].get("referenceId")
@pytest.mark.parametrize("organizer_type", ["tags", "categories", "tools"])
def test_get_recipes_organizer_filter(api_client: TestClient, unique_user: utils.TestUser, organizer_type: str):
database = unique_user.repos

View File

@@ -217,7 +217,7 @@ def test_preserve_future_made_date(api_client: TestClient, unique_user: TestUser
future_dt = datetime.now(UTC) + timedelta(days=random_int(1, 10))
response = api_client.patch(
api_routes.recipes_slug_last_made(recipe.slug),
data=RecipeLastMade(timestamp=future_dt).model_dump_json(),
json=RecipeLastMade(timestamp=future_dt).model_dump(mode="json"),
headers=unique_user.token,
)
assert response.status_code == 200