forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add device info to Hydrawise (home-assistant#100828)
* Add device info to Hydrawise * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker <[email protected]> * Remove _attr_has_entity_name --------- Co-authored-by: Joost Lekkerkerker <[email protected]>
- Loading branch information
Showing
6 changed files
with
143 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Tests for Hydrawise devices.""" | ||
|
||
from unittest.mock import Mock | ||
|
||
from homeassistant.components.hydrawise.const import DOMAIN | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import device_registry as dr | ||
|
||
|
||
def test_zones_in_device_registry( | ||
hass: HomeAssistant, mock_added_config_entry: ConfigEntry, mock_pydrawise: Mock | ||
) -> None: | ||
"""Test that devices are added to the device registry.""" | ||
device_registry = dr.async_get(hass) | ||
|
||
device1 = device_registry.async_get_device(identifiers={(DOMAIN, "5965394")}) | ||
assert device1 is not None | ||
assert device1.name == "Zone One" | ||
assert device1.manufacturer == "Hydrawise" | ||
|
||
device2 = device_registry.async_get_device(identifiers={(DOMAIN, "5965395")}) | ||
assert device2 is not None | ||
assert device2.name == "Zone Two" | ||
assert device2.manufacturer == "Hydrawise" | ||
|
||
|
||
def test_controller_in_device_registry( | ||
hass: HomeAssistant, mock_added_config_entry: ConfigEntry, mock_pydrawise: Mock | ||
) -> None: | ||
"""Test that devices are added to the device registry.""" | ||
device_registry = dr.async_get(hass) | ||
device = device_registry.async_get_device(identifiers={(DOMAIN, "52496")}) | ||
assert device is not None | ||
assert device.name == "Home Controller" | ||
assert device.manufacturer == "Hydrawise" |