Fix tests & lint

This commit is contained in:
Paulus Schoutsen committed 2019-12-04 22:47:40 -08:00
1 parent 28e9f1d0b8
commit dad11f8208
14 files changed
+112 -87

No files matched your search

@@ -44,7 +44,9 @@ async def test_events_fired_properly(hass):
def listener(event):
events.append(event)
with patch("emulated_roku.EmulatedRokuServer", instantiate):
with patch(
"homeassistant.components.emulated_roku.binding.EmulatedRokuServer", instantiate
):
hass.bus.async_listen(EVENT_ROKU_COMMAND, listener)
assert await binding.setup() is True
+4 -4
View File
@@ -10,7 +10,7 @@ from tests.common import mock_coro_func
async def test_config_required_fields(hass):
"""Test that configuration is successful with required fields."""
with patch.object(emulated_roku, "configured_servers", return_value=[]), patch(
"emulated_roku.EmulatedRokuServer",
"homeassistant.components.emulated_roku.binding.EmulatedRokuServer",
return_value=Mock(start=mock_coro_func(), close=mock_coro_func()),
):
assert (
@@ -35,7 +35,7 @@ async def test_config_required_fields(hass):
async def test_config_already_registered_not_configured(hass):
"""Test that an already registered name causes the entry to be ignored."""
with patch(
"emulated_roku.EmulatedRokuServer",
"homeassistant.components.emulated_roku.binding.EmulatedRokuServer",
return_value=Mock(start=mock_coro_func(), close=mock_coro_func()),
) as instantiate, patch.object(
emulated_roku, "configured_servers", return_value=["Emulated Roku Test"]
@@ -74,7 +74,7 @@ async def test_setup_entry_successful(hass):
}
with patch(
"emulated_roku.EmulatedRokuServer",
"homeassistant.components.emulated_roku.binding.EmulatedRokuServer",
return_value=Mock(start=mock_coro_func(), close=mock_coro_func()),
) as instantiate:
assert await emulated_roku.async_setup_entry(hass, entry) is True
@@ -98,7 +98,7 @@ async def test_unload_entry(hass):
entry.data = {"name": "Emulated Roku Test", "listen_port": 8060}
with patch(
"emulated_roku.EmulatedRokuServer",
"homeassistant.components.emulated_roku.binding.EmulatedRokuServer",
return_value=Mock(start=mock_coro_func(), close=mock_coro_func()),
):
assert await emulated_roku.async_setup_entry(hass, entry) is True