Address late review for NextDNS entity name translations (#90771)

This commit is contained in:
Maciej Bieniek
2023-04-04 12:56:39 +02:00
committed by GitHub
parent b66a99fe8a
commit 2f22613cf9
3 changed files with 13 additions and 23 deletions
+7 -17
View File
@@ -20,26 +20,22 @@ async def test_binary_Sensor(hass: HomeAssistant) -> None:
await init_integration(hass)
state = hass.states.get(
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
)
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
assert state
assert state.state == STATE_ON
entry = registry.async_get(
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
)
entry = registry.async_get("binary_sensor.fake_profile_device_connection_status")
assert entry
assert entry.unique_id == "xyz12_this_device_nextdns_connection_status"
state = hass.states.get(
"binary_sensor.fake_profile_this_device_profile_connection_status"
"binary_sensor.fake_profile_device_profile_connection_status"
)
assert state
assert state.state == STATE_OFF
entry = registry.async_get(
"binary_sensor.fake_profile_this_device_profile_connection_status"
"binary_sensor.fake_profile_device_profile_connection_status"
)
assert entry
assert entry.unique_id == "xyz12_this_device_profile_connection_status"
@@ -49,9 +45,7 @@ async def test_availability(hass: HomeAssistant) -> None:
"""Ensure that we mark the entities unavailable correctly when service causes an error."""
await init_integration(hass)
state = hass.states.get(
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
)
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
assert state
assert state.state != STATE_UNAVAILABLE
assert state.state == STATE_ON
@@ -64,9 +58,7 @@ async def test_availability(hass: HomeAssistant) -> None:
async_fire_time_changed(hass, future)
await hass.async_block_till_done()
state = hass.states.get(
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
)
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
assert state
assert state.state == STATE_UNAVAILABLE
@@ -78,9 +70,7 @@ async def test_availability(hass: HomeAssistant) -> None:
async_fire_time_changed(hass, future)
await hass.async_block_till_done()
state = hass.states.get(
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
)
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
assert state
assert state.state != STATE_UNAVAILABLE
assert state.state == STATE_ON