autoformat

This commit is contained in:
jableader 2025-11-02 18:55:55 +11:00
parent 14bdcbb202
commit e801c9056d
2 changed files with 8 additions and 8 deletions

View file

@ -241,7 +241,9 @@ async def create_meal_scoped(
getattr(ing, "product_id", None) is not None and getattr(ing, "product_id") >= 0
)
if not has_product and name == "" and line == "":
return error_response(request, 400, "Ingredient must include a name or line or a product")
return error_response(
request, 400, "Ingredient must include a name or line or a product"
)
# quantity must be > 0
try:
q = float(getattr(ing, "quantity", 0))
@ -392,7 +394,9 @@ async def update_meal_scoped(
getattr(ing, "product_id", None) is not None and getattr(ing, "product_id") >= 0
)
if not has_product and name == "" and line == "":
return error_response(request, 400, "Ingredient must include a name or line or a product")
return error_response(
request, 400, "Ingredient must include a name or line or a product"
)
try:
q = float(getattr(ing, "quantity", 0))
except Exception:

View file

@ -71,9 +71,7 @@ class TestRecipeIngredientsLoadedV2(unittest.IsolatedAsyncioTestCase):
def test_get_by_id_includes_ingredients(self):
rid, expected = self._create_recipe()
g = self.client.get(
f"/api/v1/households/{self.slug}/recipes/{rid}", headers=self.headers
)
g = self.client.get(f"/api/v1/households/{self.slug}/recipes/{rid}", headers=self.headers)
assert g.status_code == 200, g.text
body = g.json()
ings = body.get("ingredients", [])
@ -83,9 +81,7 @@ class TestRecipeIngredientsLoadedV2(unittest.IsolatedAsyncioTestCase):
def test_list_includes_ingredients(self):
rid, expected = self._create_recipe()
lst = self.client.get(
f"/api/v1/households/{self.slug}/recipes", headers=self.headers
)
lst = self.client.get(f"/api/v1/households/{self.slug}/recipes", headers=self.headers)
assert lst.status_code == 200, lst.text
items = lst.json().get("items", [])
# Find our recipe