|
|
|
@ -157,8 +157,10 @@ async def test_setup_with_properties(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(response)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
|
|
|
|
|
@ -188,6 +190,7 @@ async def test_reconnect(hass, caplog, config):
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -256,8 +259,10 @@ async def test_adb_shell_returns_none(hass, config):
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
@ -284,8 +289,10 @@ async def test_setup_with_adbkey(hass):
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER, PATCH_ISFILE, PATCH_ACCESS:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
@ -317,8 +324,10 @@ async def test_sources(hass, config0):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
@ -395,8 +404,10 @@ async def _test_exclude_sources(hass, config0, expected_sources):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
@ -475,8 +486,10 @@ async def _test_select_source(hass, config0, source, expected_arg, method_patch)
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is not None
|
|
|
|
@ -701,8 +714,10 @@ async def test_setup_fail(hass, config):
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id) is False
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|
await hass.helpers.entity_component.async_update_entity(entity_id)
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
assert state is None
|
|
|
|
@ -718,6 +733,7 @@ async def test_adb_command(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -747,6 +763,7 @@ async def test_adb_command_unicode_decode_error(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -776,6 +793,7 @@ async def test_adb_command_key(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -805,6 +823,7 @@ async def test_adb_command_get_properties(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -834,6 +853,7 @@ async def test_learn_sendevent(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -862,6 +882,7 @@ async def test_update_lock_not_acquired(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -897,6 +918,7 @@ async def test_download(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -943,6 +965,7 @@ async def test_upload(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -987,6 +1010,7 @@ async def test_androidtv_volume_set(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1014,6 +1038,7 @@ async def test_get_image(hass, hass_ws_client):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1090,6 +1115,7 @@ async def test_services_androidtv(hass):
|
|
|
|
|
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
|
|
|
|
|
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1136,6 +1162,7 @@ async def test_services_firetv(hass):
|
|
|
|
|
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
|
|
|
|
|
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1152,6 +1179,7 @@ async def test_volume_mute(hass):
|
|
|
|
|
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
|
|
|
|
|
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1196,6 +1224,7 @@ async def test_connection_closed_on_ha_stop(hass):
|
|
|
|
|
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
@ -1220,6 +1249,7 @@ async def test_exception(hass):
|
|
|
|
|
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
|
|
|
|
|
patch_key
|
|
|
|
|
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
|
|
|
|
|
with patchers.PATCH_DEVICE_PROPERTIES:
|
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
|
|