Update a-c* tests to use entity & device registry fixtures (#103793)

* Update a-c* tests to use entity & device registry fixtures

* Revert some changes

* Revert formatting

* retrigger CI
This commit is contained in:
Jan-Philipp Benecke 2023-11-12 19:45:30 +01:00 committed by GitHub
parent abb1328a67
commit 9ab1cb83d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 239 additions and 161 deletions

View file

@ -502,18 +502,20 @@ async def test_ws_list(
async def test_ws_delete(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, storage_setup
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
entity_registry: er.EntityRegistry,
storage_setup,
) -> None:
"""Test WS delete cleans up entity registry."""
assert await storage_setup()
input_id = "from_storage"
input_entity_id = f"{DOMAIN}.{input_id}"
ent_reg = er.async_get(hass)
state = hass.states.get(input_entity_id)
assert state is not None
assert ent_reg.async_get_entity_id(DOMAIN, DOMAIN, input_id) is not None
assert entity_registry.async_get_entity_id(DOMAIN, DOMAIN, input_id) is not None
client = await hass_ws_client(hass)
@ -525,7 +527,7 @@ async def test_ws_delete(
state = hass.states.get(input_entity_id)
assert state is None
assert ent_reg.async_get_entity_id(DOMAIN, DOMAIN, input_id) is None
assert entity_registry.async_get_entity_id(DOMAIN, DOMAIN, input_id) is None
async def test_update_min_max(
@ -546,7 +548,7 @@ async def test_update_min_max(
input_id = "from_storage"
input_entity_id = f"{DOMAIN}.{input_id}"
ent_reg = er.async_get(hass)
entity_registry = er.async_get(hass)
state = hass.states.get(input_entity_id)
assert state is not None
@ -554,7 +556,7 @@ async def test_update_min_max(
assert state.attributes[ATTR_MAXIMUM] == 100
assert state.attributes[ATTR_MINIMUM] == 10
assert state.attributes[ATTR_STEP] == 3
assert ent_reg.async_get_entity_id(DOMAIN, DOMAIN, input_id) is not None
assert entity_registry.async_get_entity_id(DOMAIN, DOMAIN, input_id) is not None
client = await hass_ws_client(hass)
@ -627,11 +629,11 @@ async def test_create(
counter_id = "new_counter"
input_entity_id = f"{DOMAIN}.{counter_id}"
ent_reg = er.async_get(hass)
entity_registry = er.async_get(hass)
state = hass.states.get(input_entity_id)
assert state is None
assert ent_reg.async_get_entity_id(DOMAIN, DOMAIN, counter_id) is None
assert entity_registry.async_get_entity_id(DOMAIN, DOMAIN, counter_id) is None
client = await hass_ws_client(hass)