1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00
* fix #1144

* fix type checks

* refactor test routes package

* fix #1208

* unify test routes into module
This commit is contained in:
Hayden 2022-05-07 20:08:04 -08:00 committed by GitHub
parent 07f6446526
commit 68f7efc177
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 189 additions and 148 deletions

View file

@ -26,7 +26,7 @@ def test_associate_ingredient_with_step(api_client: TestClient, unique_user: Tes
steps[idx] = [str(ingredient.reference_id) for ingredient in ingredients]
response = api_client.put(
routes.RoutesRecipe.item(recipe.slug),
routes.recipes.Recipe.item(recipe.slug),
json=jsonify(recipe.dict()),
headers=unique_user.token,
)
@ -35,14 +35,14 @@ def test_associate_ingredient_with_step(api_client: TestClient, unique_user: Tes
# Get Recipe and check that the ingredient is associated with the step
response = api_client.get(routes.RoutesRecipe.item(recipe.slug), headers=unique_user.token)
response = api_client.get(routes.recipes.Recipe.item(recipe.slug), headers=unique_user.token)
assert response.status_code == 200
recipe = json.loads(response.text)
data: dict = json.loads(response.text)
for idx, step in enumerate(recipe.get("recipeInstructions")):
all_refs = [ref["referenceId"] for ref in step.get("ingredientReferences")]
for idx, stp in enumerate(data.get("recipeInstructions")):
all_refs = [ref["referenceId"] for ref in stp.get("ingredientReferences")]
assert len(all_refs) == 2