From 3b82acb390301fd6758f0738749cc660003aacf7 Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Fri, 11 Jul 2025 16:36:41 +0000 Subject: [PATCH] update/remove tests --- dev/scripts/all_recipes_stress_test.py | 14 ----- tests/fixtures/fixture_shopping_lists.py | 1 - .../test_admin_household_actions.py | 1 - .../test_public_recipes.py | 1 - .../test_recipe_ingredients.py | 4 +- .../test_recipe_suggestions.py | 57 +------------------ .../test_shopping_list_ingredient.py | 2 - 7 files changed, 2 insertions(+), 78 deletions(-) diff --git a/dev/scripts/all_recipes_stress_test.py b/dev/scripts/all_recipes_stress_test.py index 0ce27cb13..ffdded3a0 100644 --- a/dev/scripts/all_recipes_stress_test.py +++ b/dev/scripts/all_recipes_stress_test.py @@ -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": [], diff --git a/tests/fixtures/fixture_shopping_lists.py b/tests/fixtures/fixture_shopping_lists.py index ab73d82b5..4d2323808 100644 --- a/tests/fixtures/fixture_shopping_lists.py +++ b/tests/fixtures/fixture_shopping_lists.py @@ -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, diff --git a/tests/integration_tests/admin_tests/test_admin_household_actions.py b/tests/integration_tests/admin_tests/test_admin_household_actions.py index e2e46cbfb..47f3771bc 100644 --- a/tests/integration_tests/admin_tests/test_admin_household_actions.py +++ b/tests/integration_tests/admin_tests/test_admin_household_actions.py @@ -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(), }, } diff --git a/tests/integration_tests/public_explorer_tests/test_public_recipes.py b/tests/integration_tests/public_explorer_tests/test_public_recipes.py index ac6311555..75b814890 100644 --- a/tests/integration_tests/public_explorer_tests/test_public_recipes.py +++ b/tests/integration_tests/public_explorer_tests/test_public_recipes.py @@ -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 diff --git a/tests/integration_tests/user_recipe_tests/test_recipe_ingredients.py b/tests/integration_tests/user_recipe_tests/test_recipe_ingredients.py index 9aadb9a20..57d101f30 100644 --- a/tests/integration_tests/user_recipe_tests/test_recipe_ingredients.py +++ b/tests/integration_tests/user_recipe_tests/test_recipe_ingredients.py @@ -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 diff --git a/tests/integration_tests/user_recipe_tests/test_recipe_suggestions.py b/tests/integration_tests/user_recipe_tests/test_recipe_suggestions.py index cb3f0c772..b61f34e40 100644 --- a/tests/integration_tests/user_recipe_tests/test_recipe_suggestions.py +++ b/tests/integration_tests/user_recipe_tests/test_recipe_suggestions.py @@ -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) diff --git a/tests/unit_tests/schema_tests/test_shopping_list_ingredient.py b/tests/unit_tests/schema_tests/test_shopping_list_ingredient.py index 8d6f223da..4507ce0e3 100644 --- a/tests/unit_tests/schema_tests/test_shopping_list_ingredient.py +++ b/tests/unit_tests/schema_tests/test_shopping_list_ingredient.py @@ -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,