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

feat: Add Households to Mealie (#3970)

This commit is contained in:
Michael Genson 2024-08-22 10:14:32 -05:00 committed by GitHub
parent 0c29cef17d
commit eb170cc7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
315 changed files with 6975 additions and 3577 deletions

View file

@ -1,6 +1,6 @@
from fastapi.testclient import TestClient
from mealie.repos.repository_factory import AllRepositories
from mealie.schema.response.pagination import PaginationQuery
from tests.utils import api_routes
from tests.utils.fixture_schemas import TestUser
@ -11,46 +11,49 @@ def test_seed_invalid_locale(api_client: TestClient, unique_user: TestUser):
assert resp.status_code == 422
def test_seed_foods(api_client: TestClient, unique_user: TestUser, database: AllRepositories):
def test_seed_foods(api_client: TestClient, unique_user: TestUser):
CREATED_FOODS = 220
database = unique_user.repos
# Check that the foods was created
foods = database.ingredient_foods.by_group(unique_user.group_id).get_all()
foods = database.ingredient_foods.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(foods) == 0
resp = api_client.post(api_routes.groups_seeders_foods, json={"locale": "en-US"}, headers=unique_user.token)
assert resp.status_code == 200
# Check that the foods was created
foods = database.ingredient_foods.by_group(unique_user.group_id).get_all()
foods = database.ingredient_foods.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(foods) == CREATED_FOODS
def test_seed_units(api_client: TestClient, unique_user: TestUser, database: AllRepositories):
def test_seed_units(api_client: TestClient, unique_user: TestUser):
CREATED_UNITS = 23
database = unique_user.repos
# Check that the foods was created
units = database.ingredient_units.by_group(unique_user.group_id).get_all()
units = database.ingredient_units.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(units) == 0
resp = api_client.post(api_routes.groups_seeders_units, json={"locale": "en-US"}, headers=unique_user.token)
assert resp.status_code == 200
# Check that the foods was created
units = database.ingredient_units.by_group(unique_user.group_id).get_all()
units = database.ingredient_units.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(units) == CREATED_UNITS
def test_seed_labels(api_client: TestClient, unique_user: TestUser, database: AllRepositories):
def test_seed_labels(api_client: TestClient, unique_user: TestUser):
CREATED_LABELS = 21
database = unique_user.repos
# Check that the foods was created
labels = database.group_multi_purpose_labels.by_group(unique_user.group_id).get_all()
labels = database.group_multi_purpose_labels.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(labels) == 0
resp = api_client.post(api_routes.groups_seeders_labels, json={"locale": "en-US"}, headers=unique_user.token)
assert resp.status_code == 200
# Check that the foods was created
labels = database.group_multi_purpose_labels.by_group(unique_user.group_id).get_all()
labels = database.group_multi_purpose_labels.page_all(PaginationQuery(page=1, per_page=-1)).items
assert len(labels) == CREATED_LABELS