Make usb.async_is_plugged_in reflect current state

This commit is contained in:
Erik
2023-01-08 13:31:59 +01:00
parent 9c39c51a96
commit 5dfb9f3f8d
2 changed files with 10 additions and 1 deletions
+6
View File
@@ -876,6 +876,12 @@ async def test_async_is_plugged_in(hass):
await hass.async_block_till_done()
assert await usb.async_is_plugged_in(hass, matcher)
with patch("homeassistant.components.usb.comports", return_value=[]), patch.object(
hass.config_entries.flow, "async_init"
), patch("homeassistant.components.usb.REQUEST_SCAN_COOLDOWN", 0):
await hass.async_block_till_done()
assert not await usb.async_is_plugged_in(hass, matcher)
@pytest.mark.parametrize(
"matcher",