mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 08:14:30 -04:00
* generate types * use generated types * ui updates * init button link for common styles * add links * setup label views * add delete confirmation * reset when not saved * link label to foods and auto set when adding to shopping list * generate types * use inheritence to manage exception handling * fix schema generation and add test for open_api generation * add header to api docs * move list consilidation to service * split list and list items controller * shopping list/list item tests - PARTIAL * enable recipe add/remove in shopping lists * generate types * linting * init global utility components * update types and add list item api * fix import cycle and database error * add container and border classes * new recipe list component * fix tests * breakout item editor * refactor item editor * update bulk actions * update input / color contrast * type generation * refactor controller dependencies * include food/unit editor * remove console.logs * fix and update type generation * fix incorrect type for column * fix postgres error * fix delete by variable * auto remove refs * fix typo
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
import sqlalchemy
|
|
from pytest import fixture
|
|
|
|
from mealie.repos.repository_factory import AllRepositories
|
|
from mealie.schema.recipe.recipe import Recipe
|
|
from mealie.schema.recipe.recipe_ingredient import RecipeIngredient
|
|
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
|
|
|
|
|
|
@fixture(scope="session")
|
|
def raw_recipe():
|
|
return get_raw_recipe()
|
|
|
|
|
|
@fixture(scope="session")
|
|
def raw_recipe_no_image():
|
|
return get_raw_no_image()
|
|
|
|
|
|
@fixture(scope="session")
|
|
def recipe_store():
|
|
return get_recipe_test_cases()
|
|
|
|
|
|
@fixture(scope="function")
|
|
def recipe_ingredient_only(database: AllRepositories, unique_user: TestUser):
|
|
# 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="Ingredient 1"),
|
|
RecipeIngredient(note="Ingredient 2"),
|
|
RecipeIngredient(note="Ingredient 3"),
|
|
RecipeIngredient(note="Ingredient 4"),
|
|
RecipeIngredient(note="Ingredient 5"),
|
|
RecipeIngredient(note="Ingredient 6"),
|
|
],
|
|
)
|
|
|
|
model = database.recipes.create(recipe)
|
|
|
|
yield model
|
|
|
|
try:
|
|
database.recipes.delete(model.slug)
|
|
except sqlalchemy.exc.NoResultFound: # Entry Deleted in Test
|
|
pass
|