mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 05:25:26 +02:00
feat: Add Households to Mealie (#3970)
This commit is contained in:
parent
0c29cef17d
commit
eb170cc7e5
315 changed files with 6975 additions and 3577 deletions
30
tests/fixtures/fixture_shopping_lists.py
vendored
30
tests/fixtures/fixture_shopping_lists.py
vendored
|
@ -2,8 +2,7 @@ import pytest
|
|||
import sqlalchemy
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.repos.repository_factory import AllRepositories
|
||||
from mealie.schema.group.group_shopping_list import ShoppingListItemCreate, ShoppingListOut, ShoppingListSave
|
||||
from mealie.schema.household.group_shopping_list import ShoppingListItemCreate, ShoppingListOut, ShoppingListSave
|
||||
from tests.utils.factories import random_string
|
||||
from tests.utils.fixture_schemas import TestUser
|
||||
|
||||
|
@ -24,12 +23,17 @@ def create_item(list_id: UUID4) -> dict:
|
|||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def shopping_lists(database: AllRepositories, unique_user: TestUser):
|
||||
def shopping_lists(unique_user: TestUser):
|
||||
database = unique_user.repos
|
||||
models: list[ShoppingListOut] = []
|
||||
|
||||
for _ in range(3):
|
||||
model = database.group_shopping_lists.create(
|
||||
ShoppingListSave(name=random_string(10), group_id=unique_user.group_id, user_id=unique_user.user_id),
|
||||
ShoppingListSave(
|
||||
name=random_string(10),
|
||||
group_id=unique_user.group_id,
|
||||
user_id=unique_user.user_id,
|
||||
),
|
||||
)
|
||||
|
||||
models.append(model)
|
||||
|
@ -44,9 +48,14 @@ def shopping_lists(database: AllRepositories, unique_user: TestUser):
|
|||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def shopping_list(database: AllRepositories, unique_user: TestUser):
|
||||
def shopping_list(unique_user: TestUser):
|
||||
database = unique_user.repos
|
||||
model = database.group_shopping_lists.create(
|
||||
ShoppingListSave(name=random_string(10), group_id=unique_user.group_id, user_id=unique_user.user_id),
|
||||
ShoppingListSave(
|
||||
name=random_string(10),
|
||||
group_id=unique_user.group_id,
|
||||
user_id=unique_user.user_id,
|
||||
),
|
||||
)
|
||||
|
||||
yield model
|
||||
|
@ -58,9 +67,14 @@ def shopping_list(database: AllRepositories, unique_user: TestUser):
|
|||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def list_with_items(database: AllRepositories, unique_user: TestUser):
|
||||
def list_with_items(unique_user: TestUser):
|
||||
database = unique_user.repos
|
||||
list_model = database.group_shopping_lists.create(
|
||||
ShoppingListSave(name=random_string(10), group_id=unique_user.group_id, user_id=unique_user.user_id),
|
||||
ShoppingListSave(
|
||||
name=random_string(10),
|
||||
group_id=unique_user.group_id,
|
||||
user_id=unique_user.user_id,
|
||||
),
|
||||
)
|
||||
|
||||
for _ in range(10):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue