1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 03:55:22 +02:00

fixed tests

This commit is contained in:
Michael Genson 2023-12-09 17:19:27 +00:00
parent 408df286fd
commit 3a30b3216e
3 changed files with 21 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import pytest
from mealie.lang.providers import local_provider
from mealie.services.scraper import scraper
from tests.utils.recipe_data import RecipeSiteTestCase, get_recipe_test_cases
@ -18,9 +19,10 @@ and then use this test case by removing the `@pytest.mark.skip` and than testing
@pytest.mark.parametrize("recipe_test_data", test_cases)
@pytest.mark.asyncio
async def test_recipe_parser(recipe_test_data: RecipeSiteTestCase):
recipe, _ = await scraper.create_from_url(recipe_test_data.url)
translator = local_provider()
recipe, _ = await scraper.create_from_url(recipe_test_data.url, translator)
assert recipe.slug == recipe_test_data.expected_slug
assert len(recipe.recipe_instructions) == recipe_test_data.num_steps
assert len(recipe.recipe_instructions or []) == recipe_test_data.num_steps
assert len(recipe.recipe_ingredient) == recipe_test_data.num_ingredients
assert recipe.org_url == recipe_test_data.url