autoformat
This commit is contained in:
parent
14bdcbb202
commit
e801c9056d
2 changed files with 8 additions and 8 deletions
|
|
@ -241,7 +241,9 @@ async def create_meal_scoped(
|
||||||
getattr(ing, "product_id", None) is not None and getattr(ing, "product_id") >= 0
|
getattr(ing, "product_id", None) is not None and getattr(ing, "product_id") >= 0
|
||||||
)
|
)
|
||||||
if not has_product and name == "" and line == "":
|
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
|
# quantity must be > 0
|
||||||
try:
|
try:
|
||||||
q = float(getattr(ing, "quantity", 0))
|
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
|
getattr(ing, "product_id", None) is not None and getattr(ing, "product_id") >= 0
|
||||||
)
|
)
|
||||||
if not has_product and name == "" and line == "":
|
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:
|
try:
|
||||||
q = float(getattr(ing, "quantity", 0))
|
q = float(getattr(ing, "quantity", 0))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,7 @@ class TestRecipeIngredientsLoadedV2(unittest.IsolatedAsyncioTestCase):
|
||||||
|
|
||||||
def test_get_by_id_includes_ingredients(self):
|
def test_get_by_id_includes_ingredients(self):
|
||||||
rid, expected = self._create_recipe()
|
rid, expected = self._create_recipe()
|
||||||
g = self.client.get(
|
g = self.client.get(f"/api/v1/households/{self.slug}/recipes/{rid}", headers=self.headers)
|
||||||
f"/api/v1/households/{self.slug}/recipes/{rid}", headers=self.headers
|
|
||||||
)
|
|
||||||
assert g.status_code == 200, g.text
|
assert g.status_code == 200, g.text
|
||||||
body = g.json()
|
body = g.json()
|
||||||
ings = body.get("ingredients", [])
|
ings = body.get("ingredients", [])
|
||||||
|
|
@ -83,9 +81,7 @@ class TestRecipeIngredientsLoadedV2(unittest.IsolatedAsyncioTestCase):
|
||||||
|
|
||||||
def test_list_includes_ingredients(self):
|
def test_list_includes_ingredients(self):
|
||||||
rid, expected = self._create_recipe()
|
rid, expected = self._create_recipe()
|
||||||
lst = self.client.get(
|
lst = self.client.get(f"/api/v1/households/{self.slug}/recipes", headers=self.headers)
|
||||||
f"/api/v1/households/{self.slug}/recipes", headers=self.headers
|
|
||||||
)
|
|
||||||
assert lst.status_code == 200, lst.text
|
assert lst.status_code == 200, lst.text
|
||||||
items = lst.json().get("items", [])
|
items = lst.json().get("items", [])
|
||||||
# Find our recipe
|
# Find our recipe
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue