mirror of
https://github.com/home-assistant/core.git
synced 2025-11-16 06:20:07 +00:00
Suggest area for NUT based on device location (#129770)
This commit is contained in:
@@ -120,3 +120,30 @@ async def test_serial_number(hass: HomeAssistant) -> None:
|
||||
|
||||
assert device_entry is not None
|
||||
assert device_entry.serial_number == mock_serial_number
|
||||
|
||||
|
||||
async def test_device_location(hass: HomeAssistant) -> None:
|
||||
"""Test for suggested location on device."""
|
||||
mock_serial_number = "A00000000000"
|
||||
mock_device_location = "XYZ Location"
|
||||
await async_init_integration(
|
||||
hass,
|
||||
username="someuser",
|
||||
password="somepassword",
|
||||
list_vars={
|
||||
"ups.serial": mock_serial_number,
|
||||
"device.location": mock_device_location,
|
||||
},
|
||||
list_ups={"ups1": "UPS 1"},
|
||||
list_commands_return_value=[],
|
||||
)
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
assert device_registry is not None
|
||||
|
||||
device_entry = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, mock_serial_number)}
|
||||
)
|
||||
|
||||
assert device_entry is not None
|
||||
assert device_entry.suggested_area == mock_device_location
|
||||
|
||||
Reference in New Issue
Block a user