Fix Android TV 'async_get_media_image' (#40672)

This commit is contained in:
Jeff Irion authored and GitHub committed 2020-09-28 16:04:08 +02:00
1 parent ceded35a82
commit 68d75a879b
2 files changed
+25 -1

No files matched your search

@@ -1064,6 +1064,21 @@ async def test_get_image(hass, hass_ws_client):
assert msg["result"]["content_type"] == "image/png"
assert msg["result"]["content"] == base64.b64encode(b"image").decode("utf-8")
with patch(
"androidtv.basetv.basetv_async.BaseTVAsync.adb_screencap",
side_effect=RuntimeError,
):
await client.send_json(
{"id": 6, "type": "media_player_thumbnail", "entity_id": entity_id}
)
msg = await client.receive_json()
# The device is unavailable, but getting the media image did not cause an exception
state = hass.states.get(entity_id)
assert state is not None
assert state.state == STATE_UNAVAILABLE
async def _test_service(
hass,