diff --git a/tests/fixtures/player.get_now_playing_media.json b/tests/fixtures/player.get_now_playing_media.json index a02ec0e..a32aeda 100644 --- a/tests/fixtures/player.get_now_playing_media.json +++ b/tests/fixtures/player.get_now_playing_media.json @@ -1,19 +1,37 @@ { "heos": { - "command": "player/get_now_playing_media", - "result": "success", - "message": "pid={player_id}" + "command": "player/get_now_playing_media", + "result": "success", + "message": "pid={player_id}" }, "payload": { - "type": "song", - "song": "Disney Hits", - "album": "", - "artist": "", - "image_url": "", - "album_id": "", - "mid": "catalog/playlists/genres", - "qid": 1, - "sid": 13 + "type": "station", + "song": "Disney (Children's) Radio", + "station": "Disney (Children's) Radio", + "album": "Album", + "artist": "Artist", + "image_url": "http://cont-5.p-cdn.us/images/public/int/6/1/1/9/050087149116_500W_500H.jpg", + "album_id": "123456", + "mid": "4256592506324148495", + "qid": 1, + "sid": 13 }, - "options": [] -} \ No newline at end of file + "options": [ + { + "play": [ + { + "id": 11, + "name": "Thumbs Up" + }, + { + "id": 12, + "name": "Thumbs Down" + }, + { + "id": 19, + "name": "Add to HEOS Favorites" + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/test_heos.py b/tests/test_heos.py index e684bc0..d50ccb2 100644 --- a/tests/test_heos.py +++ b/tests/test_heos.py @@ -405,16 +405,19 @@ async def test_player_now_playing_changed_event( await heos.get_players() player = heos.players[1] now_playing = player.now_playing_media - assert now_playing.album == "" - assert now_playing.type == "song" - assert now_playing.album_id == "" - assert now_playing.artist == "" - assert now_playing.image_url == "" - assert now_playing.media_id == "catalog/playlists/genres" + assert now_playing.type == "station" + assert now_playing.song == "Disney (Children's) Radio" + assert now_playing.station == "Disney (Children's) Radio" + assert now_playing.album == "Album" + assert now_playing.artist == "Artist" + assert ( + now_playing.image_url + == "http://cont-5.p-cdn.us/images/public/int/6/1/1/9/050087149116_500W_500H.jpg" + ) + assert now_playing.album_id == "123456" + assert now_playing.media_id == "4256592506324148495" assert now_playing.queue_id == 1 assert now_playing.source_id == 13 - assert now_playing.song == "Disney Hits" - assert now_playing.station is None assert now_playing.supported_controls == const.CONTROLS_ALL # Attach dispatch handler @@ -1173,3 +1176,24 @@ async def test_remove_group(heos: Heos) -> None: async def test_update_group(heos: Heos) -> None: """Test removing a group.""" await heos.update_group(1, [2]) + + +@calls_command("player.get_now_playing_media", {const.ATTR_PLAYER_ID: 1}) +async def test_get_now_playing_media(heos: Heos) -> None: + """Test removing a group.""" + media = await heos.get_now_playing_media(1) + + assert media.type == "station" + assert media.song == "Disney (Children's) Radio" + assert media.station == "Disney (Children's) Radio" + assert media.album == "Album" + assert media.artist == "Artist" + assert ( + media.image_url + == "http://cont-5.p-cdn.us/images/public/int/6/1/1/9/050087149116_500W_500H.jpg" + ) + assert media.album_id == "123456" + assert media.media_id == "4256592506324148495" + assert media.queue_id == 1 + assert media.source_id == 13 + assert media.supported_controls == const.CONTROLS_ALL