From 3cdad933c79165f6cc9b6ad332370dd3ba2787e8 Mon Sep 17 00:00:00 2001 From: David Trattnig <david@subsquare.at> Date: Thu, 8 Aug 2024 14:23:48 +0200 Subject: [PATCH] test: update cases for virtual timeslot handling --- tests/test_engine_resources.py | 2 +- tests/test_scheduling_domain.py | 35 +++++++++++++++++++++++++++--- tests/test_scheduling_timetable.py | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/tests/test_engine_resources.py b/tests/test_engine_resources.py index 22b6158..bc82813 100644 --- a/tests/test_engine_resources.py +++ b/tests/test_engine_resources.py @@ -208,7 +208,7 @@ class TestEngineResources(unittest.TestCase): print(self._testMethodName) show = Show(id=123, name="some show") - episode = Episode(id="1432", title="SuperSonicShow 23/1") + episode = Episode(id="1432", title="SuperSonicShow 23/1", memo="") ts = Timeslot( id=42, repetition_id=None, start=100000, end=100360, show=show, episode=episode ) diff --git a/tests/test_scheduling_domain.py b/tests/test_scheduling_domain.py index f9e468e..a206bb6 100644 --- a/tests/test_scheduling_domain.py +++ b/tests/test_scheduling_domain.py @@ -48,7 +48,7 @@ class TestDomain(unittest.TestCase): print(self._testMethodName) show = Show(id=555, name="3angulation") - episode = Episode(id=3, title="SuperSonicShow 23/1") + episode = Episode(id=3, title="SuperSonicShow 23/1", memo="") ts = Timeslot( id=333, repetition_id=888, start=1675463003, end=1675466003, show=show, episode=episode ) @@ -132,6 +132,35 @@ class TestDomain(unittest.TestCase): self.assertIsNotNone(ts.playlists.show) self.assertEqual(pl_show, ts.get_current_playlist()) + def test_get_current_playlist_from_virtual_timeslot(self): + print(self._testMethodName) + + ts = Timeslot( + id=333, + virtual=True, + repetition_id=888, + start=1675463003, + end=1675466009, + show=None, + episode=None, + ) + + # Virtual timeslots do use playlists + self.assertTrue(ts.is_virtual()) + self.assertIsNone(ts.get_current_playlist()) + + pl_timeslot = Playlist(1, "playlist A") + pl_schedule = Playlist(2, "playlist B") + pl_show = Playlist(3, "playlist C") + + ts.set_playlists(pl_timeslot, pl_schedule, pl_show) + self.assertIsNotNone(ts.playlists.timeslot) + self.assertIsNotNone(ts.playlists.schedule) + self.assertIsNotNone(ts.playlists.show) + + # Even though there are playlists assigned, they are not returned + self.assertIsNone(ts.get_current_playlist()) + def test_playlist_duration_zero(self): print(self._testMethodName) @@ -398,8 +427,8 @@ class TestDomain(unittest.TestCase): show1 = Show(1, "show1") show2 = Show(2, "show2") - episode1 = Episode(11, "title1") - episode2 = Episode(22, "title2") + episode1 = Episode(11, "title1", "my memo for this episode") + episode2 = Episode(22, "title2", None) ts1 = Timeslot(id=333, repetition_id=888, start=100, end=120, show=show1, episode=episode1) ts2 = Timeslot(id=444, repetition_id=999, start=100, end=120, show=show2, episode=episode2) diff --git a/tests/test_scheduling_timetable.py b/tests/test_scheduling_timetable.py index 281e8a9..ecb1d6b 100644 --- a/tests/test_scheduling_timetable.py +++ b/tests/test_scheduling_timetable.py @@ -590,7 +590,7 @@ class TestSchedulingTimetable(unittest.TestCase): # Create updated timeslot show = Show(22, "Updated Show") - episode = Episode("123", "Updated Episode") + episode = Episode("123", "Updated Episode", "My memo") ts3_updated = Timeslot( id=3, repetition_id=1234, start=now + 120, end=now + 180, show=show, episode=episode ) -- GitLab