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:
parent
1e5ef28f91
commit
2afaf70a03
24 changed files with 295 additions and 65 deletions
|
@ -47,7 +47,6 @@ def register_user(api_client, invite):
|
|||
registration.group_token = invite
|
||||
|
||||
response = api_client.post(Routes.register, json=registration.dict(by_alias=True))
|
||||
print(response.json())
|
||||
return registration, response
|
||||
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ def test_read_webhook(api_client: TestClient, unique_user: TestUser, webhook_dat
|
|||
|
||||
webhook = response.json()
|
||||
|
||||
print(webhook)
|
||||
|
||||
assert webhook["id"]
|
||||
assert webhook["name"] == webhook_data["name"]
|
||||
assert webhook["url"] == webhook_data["url"]
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue