mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
update/remove tests
This commit is contained in:
parent
754f43c135
commit
3b82acb390
7 changed files with 2 additions and 78 deletions
|
@ -44,7 +44,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1 cup unsalted butter, cut into cubes",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "ea3b6702-9532-4fbc-a40b-f99917831c26",
|
||||
|
@ -54,7 +53,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1 cup light brown sugar",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "c5bbfefb-1e23-4ffd-af88-c0363a0fae82",
|
||||
|
@ -64,7 +62,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1/2 cup granulated white sugar",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "034f481b-c426-4a17-b983-5aea9be4974b",
|
||||
|
@ -74,7 +71,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "2 large eggs",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "37c1f796-3bdb-4856-859f-dbec90bc27e4",
|
||||
|
@ -84,7 +80,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "2 tsp vanilla extract",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "85561ace-f249-401d-834c-e600a2f6280e",
|
||||
|
@ -94,7 +89,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1/2 cup creamy peanut butter",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "ac91bda0-e8a8-491a-976a-ae4e72418cfd",
|
||||
|
@ -104,7 +98,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1 tsp cornstarch",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "4d1256b3-115e-4475-83cd-464fbc304cb0",
|
||||
|
@ -114,7 +107,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1 tsp baking soda",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "64627441-39f9-4ee3-8494-bafe36451d12",
|
||||
|
@ -124,7 +116,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1/2 tsp salt",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "7ae212d0-3cd1-44b0-899e-ec5bd91fd384",
|
||||
|
@ -134,7 +125,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1 cup cake flour",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "06967994-8548-4952-a8cc-16e8db228ebd",
|
||||
|
@ -144,7 +134,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "2 cups all-purpose flour",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "bdb33b23-c767-4465-acf8-3b8e79eb5691",
|
||||
|
@ -154,7 +143,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "2 cups peanut butter chips",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "12ba0af8-affd-4fb2-9cca-6f1b3e8d3aef",
|
||||
|
@ -164,7 +152,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"note": "1½ cups Reese's Pieces candies",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "4bdc0598-a3eb-41ee-8af0-4da9348fbfe2",
|
||||
|
@ -221,7 +208,6 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic
|
|||
"showAssets": False,
|
||||
"landscapeView": False,
|
||||
"disableComments": False,
|
||||
"disableAmount": True,
|
||||
"locked": False,
|
||||
},
|
||||
"assets": [],
|
||||
|
|
1
tests/fixtures/fixture_shopping_lists.py
vendored
1
tests/fixtures/fixture_shopping_lists.py
vendored
|
@ -12,7 +12,6 @@ def create_item(list_id: UUID4) -> dict:
|
|||
"shopping_list_id": str(list_id),
|
||||
"checked": False,
|
||||
"position": 0,
|
||||
"is_food": False,
|
||||
"note": random_string(10),
|
||||
"quantity": 1,
|
||||
"unit_id": None,
|
||||
|
|
|
@ -49,7 +49,6 @@ def test_admin_update_household(api_client: TestClient, admin_user: TestUser, un
|
|||
"recipeShowAssets": random_bool(),
|
||||
"recipeLandscapeView": random_bool(),
|
||||
"recipeDisableComments": random_bool(),
|
||||
"recipeDisableAmount": random_bool(),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -377,7 +377,6 @@ def test_get_suggested_recipes(
|
|||
SaveIngredientFood(id=uuid4(), name=random_string(), group_id=unique_user.group_id)
|
||||
)
|
||||
random_recipe.recipe_ingredient = [RecipeIngredient(food_id=known_food.id, food=known_food)]
|
||||
random_recipe.settings.disable_amount = False
|
||||
database.recipes.update(random_recipe.slug, random_recipe)
|
||||
|
||||
## Try to find suggested recipes
|
||||
|
|
|
@ -205,7 +205,5 @@ def test_ingredient_display(
|
|||
expected_components.append(note)
|
||||
|
||||
expected_display_value = " ".join(c for c in expected_components if c)
|
||||
ingredient = RecipeIngredient(
|
||||
quantity=quantity, unit=unit, food=food, note=note, use_food=use_food, disable_amount=not use_food
|
||||
)
|
||||
ingredient = RecipeIngredient(quantity=quantity, unit=unit, food=food, note=note, use_food=use_food)
|
||||
assert ingredient.display == expected_display_value
|
||||
|
|
|
@ -48,7 +48,6 @@ def create_recipe(
|
|||
*,
|
||||
foods: list[IngredientFood] | None = None,
|
||||
tools: list[RecipeToolOut] | None = None,
|
||||
disable_amount: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
if foods:
|
||||
|
@ -63,7 +62,7 @@ def create_recipe(
|
|||
name=kwargs.pop("name", random_string()),
|
||||
recipe_ingredient=ingredients,
|
||||
tools=tools or [],
|
||||
settings=RecipeSettings(disable_amount=disable_amount),
|
||||
settings=RecipeSettings(),
|
||||
**kwargs,
|
||||
)
|
||||
)
|
||||
|
@ -338,60 +337,6 @@ def test_include_recipes_with_no_tools(api_client: TestClient, unique_user: Test
|
|||
unique_user.repos.recipes.delete(recipe.slug)
|
||||
|
||||
|
||||
def test_ignore_recipes_with_ingredient_amounts_disabled_with_foods(api_client: TestClient, unique_user: TestUser):
|
||||
known_food = create_food(unique_user)
|
||||
recipe_with_amounts = create_recipe(unique_user, foods=[known_food])
|
||||
recipe_without_amounts = create_recipe(unique_user, foods=[known_food], disable_amount=True)
|
||||
|
||||
try:
|
||||
response = api_client.get(
|
||||
api_routes.recipes_suggestions,
|
||||
params={"maxMissingFoods": 0, "maxMissingTools": 0, "foods": [str(known_food.id)]},
|
||||
headers=unique_user.token,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
assert {item["recipe"]["id"] for item in data["items"]} == {str(recipe_with_amounts.id)}
|
||||
for item in data["items"]:
|
||||
assert item["missingFoods"] == []
|
||||
|
||||
finally:
|
||||
for recipe in [recipe_with_amounts, recipe_without_amounts]:
|
||||
unique_user.repos.recipes.delete(recipe.slug)
|
||||
|
||||
|
||||
def test_include_recipes_with_ingredient_amounts_disabled_without_foods(api_client: TestClient, unique_user: TestUser):
|
||||
known_tool = create_tool(unique_user)
|
||||
recipe_with_amounts = create_recipe(unique_user, tools=[known_tool])
|
||||
recipe_without_amounts = create_recipe(unique_user, tools=[known_tool], disable_amount=True)
|
||||
|
||||
try:
|
||||
response = api_client.get(
|
||||
api_routes.recipes_suggestions,
|
||||
params={
|
||||
"maxMissingFoods": 0,
|
||||
"maxMissingTools": 0,
|
||||
"includeFoodsOnHand": False,
|
||||
"tools": [str(known_tool.id)],
|
||||
},
|
||||
headers=unique_user.token,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
assert {item["recipe"]["id"] for item in data["items"]} == {
|
||||
str(recipe_with_amounts.id),
|
||||
str(recipe_without_amounts.id),
|
||||
}
|
||||
for item in data["items"]:
|
||||
assert item["missingFoods"] == []
|
||||
|
||||
finally:
|
||||
for recipe in [recipe_with_amounts, recipe_without_amounts]:
|
||||
unique_user.repos.recipes.delete(recipe.slug)
|
||||
|
||||
|
||||
def test_exclude_recipes_with_no_user_foods(api_client: TestClient, unique_user: TestUser):
|
||||
known_food = create_food(unique_user)
|
||||
food_on_hand = create_food(unique_user, on_hand=True)
|
||||
|
|
|
@ -20,8 +20,6 @@ def test_shopping_list_ingredient_validation():
|
|||
"updatedAt": "2024-02-26T18:29:46.190758",
|
||||
},
|
||||
"note": "",
|
||||
"isFood": True,
|
||||
"disableAmount": False,
|
||||
"shoppingListId": "dc8bce82-2da9-49f0-94e6-6d69d311490e",
|
||||
"checked": False,
|
||||
"position": 5,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue