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

Fix/multiple bug fixes (#1015)

* test-case for #1011

* revert regressions for #1011

* update cache key on new image

* lint

* fix #1012

* typing

* random_recipe fixture

* remove delete button when no listeners are present

* spacing

* update copy to match settings value
This commit is contained in:
Hayden 2022-02-27 12:48:21 -09:00 committed by GitHub
parent 6a5fd8e4f8
commit 568a1a0015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 112 additions and 18 deletions

View file

@ -5,6 +5,7 @@ from mealie.repos.repository_factory import AllRepositories
from mealie.schema.recipe.recipe import Recipe, RecipeCategory
from mealie.schema.recipe.recipe_category import CategorySave
from mealie.schema.recipe.recipe_ingredient import RecipeIngredient
from mealie.schema.recipe.recipe_step import RecipeStep
from tests.utils.factories import random_string
from tests.utils.fixture_schemas import TestUser
from tests.utils.recipe_data import get_raw_no_image, get_raw_recipe, get_recipe_test_cases
@ -70,3 +71,31 @@ def recipe_categories(database: AllRepositories, unique_user: TestUser) -> list[
database.categories.delete(model.id)
except sqlalchemy.exc.NoResultFound:
pass
@fixture(scope="function")
def random_recipe(database: AllRepositories, unique_user: TestUser) -> Recipe:
recipe = Recipe(
user_id=unique_user.user_id,
group_id=unique_user.group_id,
name=random_string(10),
recipe_ingredient=[
RecipeIngredient(note="Ingredient 1"),
RecipeIngredient(note="Ingredient 2"),
RecipeIngredient(note="Ingredient 3"),
],
recipe_instructions=[
RecipeStep(text="Step 1"),
RecipeStep(text="Step 2"),
RecipeStep(text="Step 3"),
],
)
model = database.recipes.create(recipe)
yield model
try:
database.recipes.delete(model.slug)
except sqlalchemy.exc.NoResultFound:
pass