mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-03 04:25:24 +02:00
feat(backend): ✨ rewrite mealplanner with simple api (#683)
* feat(backend): ✨ new meal-planner feature * feat(frontend): ✨ new meal plan feature * refactor(backend): ♻️ refactor base services classes and add mixins for crud * feat(frontend): ✨ add UI/API for mealplanner * feat(backend): ✨ add get_today and get_slice options for mealplanner * test(backend): ✅ add and update group mealplanner tests * fix(backend): 🐛 Fix recipe_id column type for PG Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
bdaf758712
commit
b542583303
46 changed files with 869 additions and 255 deletions
24
tests/unit_tests/validator_tests/test_create_plan_entry.py
Normal file
24
tests/unit_tests/validator_tests/test_create_plan_entry.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from datetime import date
|
||||
|
||||
import pytest
|
||||
|
||||
from mealie.schema.meal_plan.new_meal import CreatePlanEntry
|
||||
|
||||
|
||||
def test_create_plan_with_title():
|
||||
entry = CreatePlanEntry(date=date.today(), title="Test Title")
|
||||
|
||||
assert entry.title == "Test Title"
|
||||
assert entry.recipe_id is None
|
||||
|
||||
|
||||
def test_create_plan_with_slug():
|
||||
entry = CreatePlanEntry(date=date.today(), recipe_id=123)
|
||||
|
||||
assert entry.recipe_id == 123
|
||||
assert entry.title == ""
|
||||
|
||||
|
||||
def test_slug_or_title_validation():
|
||||
with pytest.raises(ValueError):
|
||||
CreatePlanEntry(date=date.today(), slug="", title="")
|
Loading…
Add table
Add a link
Reference in a new issue