mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-25 08:09:41 +02:00
test(backend): ✅ refactor testing to reduce network reliance and speed up suite
This commit is contained in:
parent
9d9412f08e
commit
1e6adb0aad
11 changed files with 11425 additions and 7 deletions
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
|
||||
from mealie.services.scraper import cleaner
|
||||
from mealie.services.scraper.scraper import open_graph
|
||||
from mealie.services.scraper.scraper_strategies import RecipeScraperOpenGraph
|
||||
from tests.test_config import TEST_RAW_HTML, TEST_RAW_RECIPES
|
||||
|
||||
# https://github.com/django/django/blob/stable/1.3.x/django/core/validators.py#L45
|
||||
|
@ -100,7 +100,10 @@ def test_cleaner_instructions(instructions):
|
|||
def test_html_with_recipe_data():
|
||||
path = TEST_RAW_HTML.joinpath("healthy_pasta_bake_60759.html")
|
||||
url = "https://www.bbc.co.uk/food/recipes/healthy_pasta_bake_60759"
|
||||
recipe_data = open_graph.basic_recipe_from_opengraph(path.read_text(), url)
|
||||
|
||||
open_graph_strategy = RecipeScraperOpenGraph(url)
|
||||
|
||||
recipe_data = open_graph_strategy.get_recipe_fields(path.read_text())
|
||||
|
||||
assert len(recipe_data["name"]) > 10
|
||||
assert len(recipe_data["slug"]) > 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue