mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-03 04:25:24 +02:00
perf(backend): ⚡ remove validation on recipe summary response (#718)
* count responses * perf(backend): ⚡ remove validation on recipe summary response use the construct() method from pydantic to reduce get time as well as optimize the SQL query for recipes * update UI to support new categories/tags * fix(backend): 🐛 restrict recipes by group Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
parent
f9829141c0
commit
568215cf70
10 changed files with 82 additions and 37 deletions
|
@ -41,7 +41,11 @@ def test_read_update(
|
|||
recipe["notes"] = test_notes
|
||||
recipe["tools"] = ["one tool", "two tool"]
|
||||
|
||||
test_categories = ["one", "two", "three"]
|
||||
test_categories = [
|
||||
{"name": "one", "slug": "one"},
|
||||
{"name": "two", "slug": "two"},
|
||||
{"name": "three", "slug": "three"},
|
||||
]
|
||||
recipe["recipeCategory"] = test_categories
|
||||
|
||||
response = api_client.put(recipe_url, json=recipe, headers=unique_user.token)
|
||||
|
@ -54,7 +58,12 @@ def test_read_update(
|
|||
recipe = json.loads(response.text)
|
||||
|
||||
assert recipe["notes"] == test_notes
|
||||
assert recipe["recipeCategory"].sort() == test_categories.sort()
|
||||
|
||||
assert len(recipe["recipeCategory"]) == len(test_categories)
|
||||
|
||||
test_name = [x["name"] for x in test_categories]
|
||||
for cats in zip(recipe["recipeCategory"], test_categories):
|
||||
assert cats[0]["name"] in test_name
|
||||
|
||||
|
||||
@pytest.mark.parametrize("recipe_data", recipe_test_data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue