From ce3b4b7b6996055c2633488992eac5359f877c25 Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Fri, 5 Jul 2024 18:18:28 -0400
Subject: [PATCH] test: update radio settings fixture & fix tests

---
 conftest.py                        |  5 ++++-
 program/tests/test_day_schedule.py | 18 ++++++++----------
 program/tests/test_playout.py      | 16 ++++++++--------
 3 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/conftest.py b/conftest.py
index abb89048..13c0c646 100644
--- a/conftest.py
+++ b/conftest.py
@@ -174,7 +174,10 @@ def fallback_show() -> Show:
 @pytest.fixture
 def radio_settings(fallback_show) -> RadioSettings:
     return RadioSettingsFactory(
-        fallback_default_pool="Musikpool", fallback_show=fallback_show, station_name="Radio AURA"
+        fallback_default_pool="fallback",
+        fallback_show=fallback_show,
+        pools={"fallback": "Station Fallback Pool"},
+        station_name="Radio AURA",
     )
 
 
diff --git a/program/tests/test_day_schedule.py b/program/tests/test_day_schedule.py
index b81fe476..e29c5433 100644
--- a/program/tests/test_day_schedule.py
+++ b/program/tests/test_day_schedule.py
@@ -44,9 +44,9 @@ def test_day_schedule(admin_api_client, api_client, once_rrule, show):
 
     entry = response.json()[0]
 
-    assert not entry["isVirtual"]
-    assert entry["showId"] == show.id
-    assert entry["showName"] == show.name
+    assert not entry["timeslot"]["isVirtual"]
+    assert entry["show"]["id"] == show.id
+    assert entry["show"]["name"] == show.name
 
 
 def test_day_schedule_include_virtual(
@@ -65,11 +65,9 @@ def test_day_schedule_include_virtual(
     assert len(response.json()) == 3
 
     for entry in response.json():
-        if entry["isVirtual"]:
-            print("V")
-            assert entry["showId"] == fallback_show.id
-            assert entry["showName"] == fallback_show.name
+        if entry["timeslot"]["isVirtual"]:
+            assert entry["show"]["id"] == fallback_show.id
+            assert entry["show"]["name"] == fallback_show.name
         else:
-            print("R")
-            assert entry["showId"] == show.id
-            assert entry["showName"] == show.name
+            assert entry["show"]["id"] == show.id
+            assert entry["show"]["name"] == show.name
diff --git a/program/tests/test_playout.py b/program/tests/test_playout.py
index 766b5edc..f1e6db06 100644
--- a/program/tests/test_playout.py
+++ b/program/tests/test_playout.py
@@ -42,9 +42,9 @@ def test_playout(admin_api_client, api_client, daily_rrule, show):
     assert len(response.json()) == 7
 
     for entry in response.json():
-        assert not entry["isVirtual"]
-        assert entry["showId"] == show.id
-        assert entry["showName"] == show.name
+        assert not entry["timeslot"]["isVirtual"]
+        assert entry["show"]["id"] == show.id
+        assert entry["show"]["name"] == show.name
 
 
 def test_playout_include_virtual(
@@ -63,9 +63,9 @@ def test_playout_include_virtual(
     assert len(response.json()) == 14 or 15
 
     for entry in response.json():
-        if entry["isVirtual"]:
-            assert entry["showId"] == fallback_show.id
-            assert entry["showName"] == fallback_show.name
+        if entry["timeslot"]["isVirtual"]:
+            assert entry["show"]["id"] == fallback_show.id
+            assert entry["show"]["name"] == fallback_show.name
         else:
-            assert entry["showId"] == show.id
-            assert entry["showName"] == show.name
+            assert entry["show"]["id"] == show.id
+            assert entry["show"]["name"] == show.name
-- 
GitLab