Files
calendar-scheduling-OPEN/tests/test_slotting.py
2026-10-06 14:47:01 -06:00

12 lines
930 B
Python

import unittest
from datetime import UTC,datetime
from scheduling_core.policy import PolicyConfig,PolicyViolation
from scheduling_core.slotting import compliant_slots
class SlotTests(unittest.TestCase):
def test_offers_three_default_duration_slots_and_rejects_no_availability(self):
c=PolicyConfig(revision='x',fixed_sender='[email protected]'); now=datetime(2030,12,31,16,tzinfo=UTC)
slots=compliant_slots(transaction_id='x',requester='[email protected]',sender='[email protected]',authentication_evidence_id='a',availability_evidence_id='b',now=now,busy_intervals=[],config=c)
self.assertEqual(len(slots),3)
blocked=[{'start_at':'2031-01-01T00:00:00Z','end_at':'2031-01-22T00:00:00Z'}]
with self.assertRaises(PolicyViolation): compliant_slots(transaction_id='y',requester='[email protected]',sender='[email protected]',authentication_evidence_id='a',availability_evidence_id='b',now=now,busy_intervals=blocked,config=c)