1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +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

@ -4,6 +4,7 @@ from pathlib import Path
import pytest
from mealie.lang.providers import local_provider
from mealie.services.scraper import cleaner
from mealie.services.scraper.scraper_strategies import RecipeScraperOpenGraph
from tests import data as test_data
@ -37,15 +38,17 @@ test_cleaner_data = [
@pytest.mark.parametrize("json_file,num_steps", test_cleaner_data)
def test_cleaner_clean(json_file: Path, num_steps):
recipe_data = cleaner.clean(json.loads(json_file.read_text()))
translator = local_provider()
recipe_data = cleaner.clean(json.loads(json_file.read_text()), translator)
assert len(recipe_data["recipeInstructions"]) == num_steps
def test_html_with_recipe_data():
path = test_data.html_healthy_pasta_bake_60759
url = "https://www.bbc.co.uk/food/recipes/healthy_pasta_bake_60759"
translator = local_provider()
open_graph_strategy = RecipeScraperOpenGraph(url)
open_graph_strategy = RecipeScraperOpenGraph(url, translator)
recipe_data = open_graph_strategy.get_recipe_fields(path.read_text())