Files
core/tests/components/igloohome/test_utils.py
Keith ff622af888 Add locking and unlocking feature to igloohome integration (#136002)
* - Added lock platform
- Added creation of IgloohomeLockEntity when bridge devices are included.

* - Migrated retrieval of linked_bridge utility to utils module.
- Added ability for lock to update it's own linked bridge automatically

* - Added mock bridge device to test fixture

* - Added snapshot test for lock module

* - Added bridge with no linked devices
- Added test for util.get_linked_bridge

* - Added handling of errors from API call

* - Bump igloohome-api to v0.1.0

* - Minor change

* - Removed async update for locks. Focus on MVP

* - Removed need for update on entity creation

* - Updated snapshot test

* - Updated snapshot

* - Updated to use walrus during lock entity creation
- Updated callback class for async_setup_entry based on lint suggestion

* - Set _attr_name as None
- Updated snapshot test

* Update homeassistant/components/igloohome/lock.py

* Update homeassistant/components/igloohome/lock.py

---------

Co-authored-by: Josef Zweck <josef@zweck.dev>
2025-03-09 20:47:13 +01:00

32 lines
934 B
Python

"""Test functions in utils module."""
from homeassistant.components.igloohome.utils import get_linked_bridge
from .conftest import (
GET_DEVICE_INFO_RESPONSE_BRIDGE_LINKED_LOCK,
GET_DEVICE_INFO_RESPONSE_BRIDGE_NO_LINKED_DEVICE,
GET_DEVICE_INFO_RESPONSE_LOCK,
)
def test_get_linked_bridge_expect_bridge_id_returned() -> None:
"""Test that get_linked_bridge returns the bridge ID."""
assert (
get_linked_bridge(
GET_DEVICE_INFO_RESPONSE_LOCK.deviceId,
[GET_DEVICE_INFO_RESPONSE_BRIDGE_LINKED_LOCK],
)
== GET_DEVICE_INFO_RESPONSE_BRIDGE_LINKED_LOCK.deviceId
)
def test_get_linked_bridge_expect_none_returned() -> None:
"""Test that get_linked_bridge returns None."""
assert (
get_linked_bridge(
GET_DEVICE_INFO_RESPONSE_LOCK.deviceId,
[GET_DEVICE_INFO_RESPONSE_BRIDGE_NO_LINKED_DEVICE],
)
is None
)