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

[Feat] Migrate from Pages to Cookbooks (#664)

* feat:  Add Description to Cookbooks

* feat(frontend):  Cookbook view page

* feat(frontend): 💄 Add final UI touches

* fix(backend): 🐛 Add get by slug or id

* fix linting issue

* test(backend):  Update tests from pages -> cookbooks

* refactor(backend): 🔥 Delete old page files

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-08-31 18:51:34 -08:00 committed by GitHub
parent 165fd8efd6
commit 9b1bf56a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 167 additions and 173 deletions

View file

@ -0,0 +1,43 @@
import json
import pytest
from fastapi.testclient import TestClient
from tests.app_routes import AppRoutes
@pytest.fixture()
def page_data():
return {"name": "My New Page", "description": "", "position": 0, "categories": [], "groupId": 1}
def test_create_cookbook(api_client: TestClient, api_routes: AppRoutes, admin_token, page_data):
response = api_client.post(api_routes.group_cookbook, json=page_data, headers=admin_token)
assert response.status_code == 200
def test_read_cookbook(api_client: TestClient, api_routes: AppRoutes, page_data, admin_token):
response = api_client.get(api_routes.group_cookbook_id(1), headers=admin_token)
page_data["id"] = 1
page_data["slug"] = "my-new-page"
assert json.loads(response.text) == page_data
def test_update_cookbook(api_client: TestClient, api_routes: AppRoutes, page_data, admin_token):
page_data["id"] = 1
page_data["name"] = "My New Name"
response = api_client.put(api_routes.group_cookbook_id(1), json=page_data, headers=admin_token)
assert response.status_code == 200
def test_delete_cookbook(api_client: TestClient, api_routes: AppRoutes, admin_token):
response = api_client.delete(api_routes.group_cookbook_id(1), headers=admin_token)
assert response.status_code == 200
response = api_client.get(api_routes.group_cookbook_id(1), headers=admin_token)
assert response.status_code == 404