fix: escape member.name in step_email; add all-voted reminder test

This commit is contained in:
2026-05-08 21:40:00 -07:00
parent 3b28ad0e1c
commit aea47d8365
2 changed files with 31 additions and 1 deletions
+30
View File
@@ -417,6 +417,36 @@ def test_step_reminder_skips_voter(
assert weekly_run_emailed.reminded_at is not None
def test_step_reminder_no_sends_when_all_voted(
db, weekly_run_emailed, meal_plan, pending_item, member, monkeypatch
):
from app.models import MealPlanVote
# Member has voted on the only pending item
vote = MealPlanVote(
meal_plan_item_id=pending_item.id,
family_member_id=member.id,
vote=True,
)
db.add(vote)
db.flush()
sent = []
class FakeBackend:
def send(self, **kwargs):
sent.append(kwargs)
monkeypatch.setattr(
"app.services.orchestrator.steps.get_email_backend",
lambda: FakeBackend(),
)
from app.services.orchestrator.steps import step_reminder
step_reminder(weekly_run_emailed, db)
# All items voted on — no emails sent, but reminded_at still stamped
assert len(sent) == 0
assert weekly_run_emailed.reminded_at is not None
# ---------------------------------------------------------------------------
# step_deadline tests
# ---------------------------------------------------------------------------