1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

feat(backend): Minor linting, bulk URL import, and improve BG tasks (#760)

* Fixes #751

* Fixes not showing original URL

* start slice at 0 instead of 1

* remove print statements

* add linter for print statements and remove print

* hide all buttons when edit disabled

* add bulk import API

* update attribute bindings

* unify button styles

* bulk add recipe feature

* thanks linter!

* uncomment code

Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-10-28 19:28:33 -08:00 committed by GitHub
parent 1e5ef28f91
commit 2afaf70a03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 295 additions and 65 deletions

View file

@ -0,0 +1,35 @@
import pytest
from fastapi.testclient import TestClient
from tests.utils.fixture_schemas import TestUser
class Routes:
base = "/api/recipes"
bulk = "/api/recipes/create-url/bulk"
def item(item_id: str) -> str:
return f"{Routes.base}/{item_id}"
@pytest.mark.skip("Long Running Scraper")
def test_bulk_import(api_client: TestClient, unique_user: TestUser):
recipes = {
"imports": [
{"url": "https://www.bonappetit.com/recipe/caramel-crunch-chocolate-chunklet-cookies"},
{"url": "https://www.allrecipes.com/recipe/10813/best-chocolate-chip-cookies/"},
]
}
slugs = [
"caramel-crunch-chocolate-chunklet-cookies",
"best-chocolate-chip-cookies",
]
response = api_client.post(Routes.bulk, json=recipes, headers=unique_user.token)
assert response.status_code == 201
for slug in slugs:
response = api_client.get(Routes.item(slug), headers=unique_user.token)
assert response.status_code == 200

View file

@ -73,5 +73,4 @@ def test_delete_food(api_client: TestClient, food: dict, unique_user: TestUser):
assert response.status_code == 200
response = api_client.get(Routes.item(id), headers=unique_user.token)
print(response.json())
assert response.status_code == 404