fix music navs
Deploy HEOS panel / deploy (push) Successful in 25s

This commit is contained in:
2026-09-15 23:19:11 +02:00
parent 7c19ff9096
commit 5b82a24ac4
9 changed files with 299 additions and 72 deletions
+33
View File
@@ -182,6 +182,39 @@ class PanelTest(unittest.TestCase):
state = self.panel.state()
self.assertEqual([r["spotify"] for r in state["rooms"]], [True, False])
def test_state_carries_the_song_a_room_is_playing(self):
self.heos.now_playing_mid[HOME400_PID] = "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
self.heos.now_playing_track[HOME400_PID] = {
"song": "Harvest Moon", "artist": "Neil Young", "image_url": "https://i.scdn.co/image/abc",
}
state = self.panel.state()
self.assertEqual(
[r["now_playing"] for r in state["rooms"]],
[{"song": "Harvest Moon", "artist": "Neil Young", "image": "https://i.scdn.co/image/abc"}, None],
)
def test_a_song_without_artist_or_cover_still_shows(self):
self.heos.now_playing_mid[HOME400_PID] = "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
self.heos.now_playing_track[HOME400_PID] = {"song": "Harvest Moon", "artist": "", "image_url": ""}
self.assertEqual(
self.panel.state()["rooms"][0]["now_playing"],
{"song": "Harvest Moon", "artist": None, "image": None},
)
def test_a_paused_room_keeps_its_song_and_a_stopped_one_drops_it(self):
self.heos.now_playing_mid[HOME400_PID] = "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
self.heos.now_playing_track[HOME400_PID] = {"song": "Harvest Moon"}
self.heos.play_states[HOME400_PID] = "pause"
self.assertIsNotNone(self.panel.state()["rooms"][0]["now_playing"])
self.heos.play_states[HOME400_PID] = "stop"
self.assertIsNone(self.panel.state()["rooms"][0]["now_playing"])
def test_an_avr_input_is_not_a_song(self):
"""HEOS puts an input's own name where the song goes."""
self.heos.now_playing_mid[HOME400_PID] = "inputs/mediaplayer"
self.heos.now_playing_track[HOME400_PID] = {"song": "Z30 Pro"}
self.assertIsNone(self.panel.state()["rooms"][0]["now_playing"])
def test_an_avr_input_is_not_spotify(self):
self.heos.now_playing_sid[AVR_PID] = 1027
self.assertFalse(self.panel.on_spotify("avr"))