All checks were successful
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 4m57s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
Bestehende Recurring-Pfade bleiben kompatibel (interval_days-Fallback, Migration backfillt schedules), damit der aktuelle Betrieb nicht bricht und der Stand auf einem zweiten Rechner weitergebaut werden kann. Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Unit tests for schedule due-date logic (no DB)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import date, datetime, timezone
|
|
|
|
from services.schedule import (
|
|
format_schedule_label,
|
|
initial_due_at,
|
|
next_due_after_completion,
|
|
weekday_bit,
|
|
)
|
|
|
|
|
|
def test_interval_daily_label():
|
|
label = format_schedule_label({"schedule_kind": "interval", "interval_days": 1, "weekday_mask": 0})
|
|
assert label == "Täglich"
|
|
|
|
|
|
def test_weekday_mask_next_due_after_friday():
|
|
schedule = {
|
|
"schedule_kind": "weekdays",
|
|
"weekday_mask": weekday_bit(0) | weekday_bit(2) | weekday_bit(4),
|
|
"pause_until": None,
|
|
}
|
|
friday = datetime(2026, 8, 7, 12, 0, tzinfo=timezone.utc)
|
|
nxt = next_due_after_completion(schedule=schedule, completed_at=friday)
|
|
assert nxt.date() == date(2026, 8, 10)
|
|
|
|
|
|
def test_pause_until_pushes_initial_due():
|
|
schedule = {
|
|
"schedule_kind": "interval",
|
|
"interval_days": 1,
|
|
"weekday_mask": 0,
|
|
"pause_until": "2026-08-10",
|
|
}
|
|
now = datetime(2026, 8, 4, 9, 0, tzinfo=timezone.utc)
|
|
due = initial_due_at(schedule=schedule, now=now)
|
|
assert due.date() == date(2026, 8, 11)
|