mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-03 04:25:24 +02:00
Convert scraper to use async (#1915)
* add httpx depedency for async http requests * rework scraper strategies to download recipe html asynchronously * rework recipe_data_service to download recipe images asynchronously * fix recipe_parser test, so it can use async results * fix bulk import so that it also works with async scraper * fix broken recipe_parser tests * Fix issues found by scanners * Add additional checks for ingredient and instruction count in test_create_by_url * Revert changes in test recipe_data Since we are checking ingredients and instructions in test_create_url now, these would fail with the stored html of recipe data * Add explicit type annotation in recipe_data_service.largest_content_len * Fix typo in annotation
This commit is contained in:
parent
7275dd2696
commit
3415a9c310
11 changed files with 129 additions and 115 deletions
|
@ -21,7 +21,7 @@ def test_bulk_import(api_client: TestClient, unique_user: TestUser):
|
|||
|
||||
response = api_client.post(api_routes.recipes_create_url_bulk, json=recipes, headers=unique_user.token)
|
||||
|
||||
assert response.status_code == 201
|
||||
assert response.status_code == 202
|
||||
|
||||
for slug in slugs:
|
||||
response = api_client.get(api_routes.recipes_slug(slug), headers=unique_user.token)
|
||||
|
|
|
@ -89,6 +89,16 @@ def test_create_by_url(
|
|||
assert response.status_code == 201
|
||||
assert json.loads(response.text) == recipe_data.expected_slug
|
||||
|
||||
recipe = api_client.get(api_routes.recipes_slug(recipe_data.expected_slug), headers=unique_user.token)
|
||||
|
||||
assert recipe.status_code == 200
|
||||
|
||||
recipe_dict: dict = json.loads(recipe.text)
|
||||
|
||||
assert recipe_dict["slug"] == recipe_data.expected_slug
|
||||
assert len(recipe_dict["recipeInstructions"]) == recipe_data.num_steps
|
||||
assert len(recipe_dict["recipeIngredient"]) == recipe_data.num_ingredients
|
||||
|
||||
|
||||
def test_create_by_url_with_tags(
|
||||
api_client: TestClient,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue