Release v0.1.9: enforce Photos API boundary and finalize Server migration
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from pigway_frame_flow.errors import FlowError
|
||||
from pigway_frame_flow.models import Schedule
|
||||
from pigway_frame_flow.scheduler.engine import next_run
|
||||
|
||||
|
||||
@pytest.mark.parametrize("minutes", [1, 7, 60, 120, 420, 10080])
|
||||
def test_interval_crosses_calendar_boundaries(minutes):
|
||||
start = datetime(2026, 10, 16, 23, 58, tzinfo=UTC)
|
||||
schedule = Schedule(type="interval", interval_minutes=minutes)
|
||||
first = datetime.fromisoformat(next_run(schedule, start))
|
||||
assert first == start + timedelta(minutes=minutes)
|
||||
assert datetime.fromisoformat(next_run(schedule, first)) == first + timedelta(
|
||||
minutes=minutes
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("minutes", [0, -1, 10081])
|
||||
def test_invalid_interval(minutes):
|
||||
with pytest.raises(ValidationError):
|
||||
Schedule(type="interval", interval_minutes=minutes)
|
||||
|
||||
|
||||
def test_missing_interval_fails():
|
||||
with pytest.raises(FlowError):
|
||||
next_run(Schedule(type="interval"))
|
||||
Reference in New Issue
Block a user