1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-25 08:09:41 +02:00

fix: Bulk Add Recipes to Shopping List (#5054)

This commit is contained in:
Michael Genson 2025-02-27 07:58:40 -06:00 committed by GitHub
parent 3d1b76bcad
commit 716c85cc3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 306 additions and 77 deletions

View file

@ -54,6 +54,37 @@ def recipe_ingredient_only(unique_user: TestUser):
database.recipes.delete(model.slug)
@fixture(scope="function")
def recipes_ingredient_only(unique_user: TestUser):
database = unique_user.repos
recipes: list[Recipe] = []
for _ in range(3):
# Create a recipe
recipe = Recipe(
user_id=unique_user.user_id,
group_id=unique_user.group_id,
name=random_string(10),
recipe_ingredient=[
RecipeIngredient(note=f"Ingredient 1 {random_string(5)}"),
RecipeIngredient(note=f"Ingredient 2 {random_string(5)}"),
RecipeIngredient(note=f"Ingredient 3 {random_string(5)}"),
RecipeIngredient(note=f"Ingredient 4 {random_string(5)}"),
RecipeIngredient(note=f"Ingredient 5 {random_string(5)}"),
RecipeIngredient(note=f"Ingredient 6 {random_string(5)}"),
],
)
model = database.recipes.create(recipe)
recipes.append(model)
yield recipes
with contextlib.suppress(sqlalchemy.exc.NoResultFound):
for recipe in recipes:
database.recipes.delete(recipe.slug)
@fixture(scope="function")
def recipe_categories(unique_user: TestUser) -> Generator[list[CategoryOut], None, None]:
database = unique_user.repos