1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

test(backend): refactor testing to reduce network reliance and speed up suite

This commit is contained in:
hay-kot 2021-11-26 11:59:36 -09:00
parent 9d9412f08e
commit 1e6adb0aad
11 changed files with 11425 additions and 7 deletions

View file

@ -1,48 +1,62 @@
from dataclasses import dataclass
from pathlib import Path
from tests.test_config import TEST_HTML_DIR
@dataclass
class RecipeSiteTestCase:
url: str
html: str
expected_slug: str
num_ingredients: int
num_steps: int
@property
def html_file(self) -> Path:
return TEST_HTML_DIR / self.html
def get_recipe_test_cases():
return [
RecipeSiteTestCase(
url="https://www.seriouseats.com/taiwanese-three-cup-chicken-san-bei-gi-recipe",
html="taiwanese-three-cup-chicken-san-bei-gi-recipe.html",
expected_slug="taiwanese-three-cup-chicken-san-bei-ji-recipe",
num_ingredients=10,
num_steps=3,
),
RecipeSiteTestCase(
url="https://www.rezeptwelt.de/backen-herzhaft-rezepte/schinken-kaese-waffeln-ohne-viel-schnickschnack/4j0bkiig-94d4d-106529-cfcd2-is97x2ml",
html="schinken-kase-waffeln-ohne-viel-schnickschnack.html",
expected_slug="schinken-kase-waffeln-ohne-viel-schnickschnack",
num_ingredients=7,
num_steps=1, # Malformed JSON Data, can't parse steps just get one string
),
RecipeSiteTestCase(
url="https://cookpad.com/us/recipes/5544853-sous-vide-smoked-beef-ribs",
html="sous-vide-smoked-beef-ribs.html",
expected_slug="sous-vide-smoked-beef-ribs",
num_ingredients=7,
num_steps=12,
),
RecipeSiteTestCase(
url="https://www.greatbritishchefs.com/recipes/jam-roly-poly-recipe",
html="jam-roly-poly-with-custard.html",
expected_slug="jam-roly-poly-with-custard",
num_ingredients=13,
num_steps=9,
),
RecipeSiteTestCase(
url="https://recipes.anovaculinary.com/recipe/sous-vide-shrimp",
html="sous-vide-shrimp.html",
expected_slug="sous-vide-shrimp",
num_ingredients=5,
num_steps=0,
),
RecipeSiteTestCase(
url="https://www.bonappetit.com/recipe/detroit-style-pepperoni-pizza",
html="detroit-style-pepperoni-pizza.html",
expected_slug="detroit-style-pepperoni-pizza",
num_ingredients=8,
num_steps=5,