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:
parent
3d1b76bcad
commit
716c85cc3b
13 changed files with 306 additions and 77 deletions
31
tests/fixtures/fixture_recipe.py
vendored
31
tests/fixtures/fixture_recipe.py
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue