mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Convert device_sun_light_trigger test fixture to async (#89578)
This commit is contained in:
parent
234610b1cc
commit
376a6eb82a
@ -28,9 +28,11 @@ from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scanner(hass, enable_custom_integrations):
|
||||
async def scanner(hass, enable_custom_integrations):
|
||||
"""Initialize components."""
|
||||
scanner = getattr(hass.components, "test.device_tracker").get_scanner(None, None)
|
||||
scanner = await getattr(hass.components, "test.device_tracker").async_get_scanner(
|
||||
None, None
|
||||
)
|
||||
|
||||
scanner.reset()
|
||||
scanner.come_home("DEV1")
|
||||
@ -56,19 +58,16 @@ def scanner(hass, enable_custom_integrations):
|
||||
},
|
||||
},
|
||||
):
|
||||
assert hass.loop.run_until_complete(
|
||||
async_setup_component(
|
||||
hass,
|
||||
device_tracker.DOMAIN,
|
||||
{device_tracker.DOMAIN: {CONF_PLATFORM: "test"}},
|
||||
)
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
device_tracker.DOMAIN,
|
||||
{device_tracker.DOMAIN: {CONF_PLATFORM: "test"}},
|
||||
)
|
||||
|
||||
assert hass.loop.run_until_complete(
|
||||
async_setup_component(
|
||||
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
|
||||
)
|
||||
assert await async_setup_component(
|
||||
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
return scanner
|
||||
|
||||
|
@ -5,7 +5,7 @@ from homeassistant.components.device_tracker.config_entry import ScannerEntity
|
||||
from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
|
||||
|
||||
|
||||
def get_scanner(hass, config):
|
||||
async def async_get_scanner(hass, config):
|
||||
"""Return a mock scanner."""
|
||||
return SCANNER
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user