Refactor deCONZ tests (#41362)
* Use hass.config_entries.async_unload * Return config_entry from setup_deconz_integration
This commit is contained in:
parent
42fb0e9545
commit
cbb4324c84
14 changed files with 130 additions and 102 deletions
|
@ -2,6 +2,7 @@
|
|||
from copy import deepcopy
|
||||
|
||||
from homeassistant.components import deconz
|
||||
from homeassistant.components.deconz.gateway import get_gateway_from_config_entry
|
||||
import homeassistant.components.scene as scene
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -43,7 +44,8 @@ async def test_scenes(hass):
|
|||
"""Test that scenes works."""
|
||||
data = deepcopy(DECONZ_WEB_REQUEST)
|
||||
data["groups"] = deepcopy(GROUPS)
|
||||
gateway = await setup_deconz_integration(hass, get_state_response=data)
|
||||
config_entry = await setup_deconz_integration(hass, get_state_response=data)
|
||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||
|
||||
assert len(hass.states.async_all()) == 1
|
||||
assert hass.states.get("scene.light_group_scene")
|
||||
|
@ -61,6 +63,6 @@ async def test_scenes(hass):
|
|||
await hass.async_block_till_done()
|
||||
set_callback.assert_called_with("put", "/groups/1/scenes/1/recall", json={})
|
||||
|
||||
await gateway.async_reset()
|
||||
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue