feature:Mail-Einladung
CI / audit (push) Skipped
CI / checks (push) Successful in 3m59s
CI / image (push) Successful in 1m12s

This commit is contained in:
marco.morath committed 2026-11-26 09:57:20 +01:00
1 parent 675a8cd6f2
commit 639f14fc2e
43 files changed
+3017 -486

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Einladungen ohne Datenbank: Adresslisten und Termine."""
from __future__ import annotations
from datetime import UTC, datetime, timedelta
import pytest
pytest.importorskip("sqlalchemy")
from surveybox.forms import invitations
NOW = datetime(2026, 12, 1, 9, 0, tzinfo=UTC)
def test_addresses_from_pasted_text() -> None:
raw = ("Erika Mustermann <Erika@Example.org>, max@example.org; max@example.org\n"
"'kaputt@' ohne-at (anna@example.de)")
valid, invalid = invitations.parse_addresses(raw)
assert valid == ["erika@example.org", "max@example.org", "anna@example.de"]
assert invalid == ["kaputt@"]
assert invitations.parse_addresses("") == ([], [])
def test_schedule_inside_participation() -> None:
opens, closes = NOW, NOW + timedelta(days=10)
day = timedelta(days=1)
check = invitations.check_schedule
assert check(opens, closes, None, None, None) is None
assert check(opens, closes, NOW + day, NOW + 3 * day, NOW + 5 * day) is None
assert check(None, None, None, NOW, NOW + day) is None # ohne Zeitraum: nur Reihenfolge
assert check(opens, closes, NOW - day, None, None) == "schedule_before_open"
assert check(opens, closes, None, None, closes) == "schedule_after_close"
assert check(opens, closes, None, NOW + 5 * day, NOW + 3 * day) == "schedule_order"
assert check(opens, closes, NOW + 4 * day, NOW + 3 * day, None) == (
"schedule_reminder_before_invite")