Skip to content
Snippets Groups Projects
Verified Commit 8e78f71b authored by David Trattnig's avatar David Trattnig Committed by Ole Binder
Browse files

test: update test cases to handle virtual timeslots

parent 2b96eeeb
No related branches found
No related tags found
1 merge request!46Steering playout schema and virtual timeslot integration
...@@ -164,6 +164,7 @@ class TestSchedulingApiFetcher(unittest.TestCase): ...@@ -164,6 +164,7 @@ class TestSchedulingApiFetcher(unittest.TestCase):
self.assertEqual(1, ts1.playlists.timeslot.get_id()) self.assertEqual(1, ts1.playlists.timeslot.get_id())
self.assertEqual("test", ts1.playlists.timeslot.get_description()) self.assertEqual("test", ts1.playlists.timeslot.get_description())
self.assertEqual(False, ts1.playlists.timeslot.do_shuffle()) self.assertEqual(False, ts1.playlists.timeslot.do_shuffle())
self.assertEqual(False, ts1.is_virtual())
# Test Timeslot 1 - timeslot playlist # Test Timeslot 1 - timeslot playlist
pl = ts1.playlists.timeslot pl = ts1.playlists.timeslot
...@@ -231,14 +232,15 @@ class TestSchedulingApiFetcher(unittest.TestCase): ...@@ -231,14 +232,15 @@ class TestSchedulingApiFetcher(unittest.TestCase):
self.assertEqual("Show 2", ts2.show.name) self.assertEqual("Show 2", ts2.show.name)
self.assertEqual("Episode 6", ts2.episode.title) self.assertEqual("Episode 6", ts2.episode.title)
self.assertEqual(111, ts2.playlists.timeslot.get_id()) self.assertEqual(111, ts2.playlists.timeslot.get_id())
self.assertEqual("test", ts1.playlists.timeslot.get_description()) self.assertEqual("playlist 111", ts2.playlists.timeslot.get_description())
self.assertEqual(False, ts1.playlists.timeslot.do_shuffle()) self.assertEqual(True, ts2.playlists.timeslot.do_shuffle())
self.assertEqual(1, ts2.playlists.schedule.id) self.assertEqual(1, ts2.playlists.schedule.id)
self.assertEqual("test", ts1.playlists.schedule.get_description()) self.assertEqual("test", ts2.playlists.schedule.get_description())
self.assertEqual(False, ts1.playlists.schedule.do_shuffle()) self.assertEqual(False, ts2.playlists.schedule.do_shuffle())
self.assertEqual(1, ts2.playlists.show.id) self.assertEqual(1, ts2.playlists.show.id)
self.assertEqual("test", ts1.playlists.show.get_description()) self.assertEqual("test", ts2.playlists.show.get_description())
self.assertEqual(False, ts1.playlists.show.do_shuffle()) self.assertEqual(False, ts2.playlists.show.do_shuffle())
self.assertEqual(False, ts2.is_virtual())
# Test Timeslot 2 - timeslot playlist # Test Timeslot 2 - timeslot playlist
pl = ts2.playlists.timeslot pl = ts2.playlists.timeslot
...@@ -299,7 +301,7 @@ class TestSchedulingApiFetcher(unittest.TestCase): ...@@ -299,7 +301,7 @@ class TestSchedulingApiFetcher(unittest.TestCase):
self.assertIsNone(pl_items[5].next) self.assertIsNone(pl_items[5].next)
@mock.patch("aura_engine.base.api.requests.get", side_effect=mocked_requests_get) @mock.patch("aura_engine.base.api.requests.get", side_effect=mocked_requests_get)
def test_fetch_timeslot_without_playlists(self, mock_get): def test_fetch_virtual_timeslot(self, mock_get):
print(self._testMethodName) print(self._testMethodName)
# Clear cache to keep test cases isolated # Clear cache to keep test cases isolated
...@@ -323,12 +325,12 @@ class TestSchedulingApiFetcher(unittest.TestCase): ...@@ -323,12 +325,12 @@ class TestSchedulingApiFetcher(unittest.TestCase):
self.assertEqual(4, ts.show.id) self.assertEqual(4, ts.show.id)
self.assertEqual("Show 4 - Fallback show with virtual timeslot", ts.show.name) self.assertEqual("Show 4 - Fallback show with virtual timeslot", ts.show.name)
self.assertIsNone(ts.episode) self.assertIsNone(ts.episode)
self.assertEqual(True, ts.is_virtual())
# Test Timeslot 1 - there are no playlists assigned # Test Timeslot 1 - there are no playlists assigned
self.assertIsNone(ts.playlists.timeslot) self.assertIsNone(ts.playlists.timeslot)
# FIXME self.assertIsNone(ts.playlists.schedule)
# self.assertIsNone(ts.playlists.schedule) self.assertIsNone(ts.playlists.show)
# self.assertIsNone(ts.playlists.show)
@mock.patch("aura_engine.base.api.requests.get", side_effect=mocked_requests_get) @mock.patch("aura_engine.base.api.requests.get", side_effect=mocked_requests_get)
def test_fetch_with_expanded_duration(self, mock_get): def test_fetch_with_expanded_duration(self, mock_get):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment