Skip to content
Snippets Groups Projects
Commit e7d3cfee authored by David Trattnig's avatar David Trattnig
Browse files

test: scheduling window awareness

parent 755aba8f
No related branches found
No related tags found
1 merge request!35ORM-less scheduling
...@@ -149,6 +149,33 @@ class TestSchedulingTimetable(unittest.TestCase): ...@@ -149,6 +149,33 @@ class TestSchedulingTimetable(unittest.TestCase):
next = self.timetable.get_next_timeslots(1) next = self.timetable.get_next_timeslots(1)
self.assertEqual(1, len(next)) self.assertEqual(1, len(next))
def test_get_next_timeslots_in_window(self):
print(self._testMethodName)
self.config.set("scheduling_window_start", 80)
self.config.set("scheduling_window_end", 10)
now = SU.timestamp()
ts1 = Timeslot(
id=1, repetition_id=None, start=now - 180, end=now - 60, show=None, episode=None
)
ts2 = Timeslot(
id=1, repetition_id=None, start=now - 60, end=now + 60, show=None, episode=None
)
ts3 = Timeslot(
id=1, repetition_id=None, start=now + 60, end=now + 120, show=None, episode=None
)
ts4 = Timeslot(
id=1, repetition_id=None, start=now + 120, end=now + 180, show=None, episode=None
)
self.timetable.timetable = [ts1, ts2, ts3, ts4]
next = self.timetable.get_next_timeslots(window_aware=True)
self.assertEqual(1, len(next))
next = self.timetable.get_next_timeslots(max_count=1, window_aware=True)
self.assertEqual(1, len(next))
def test_get_no_next_timeslots(self): def test_get_no_next_timeslots(self):
print(self._testMethodName) print(self._testMethodName)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment