1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-04-17 23:33:35 +01:00

Listen for dbus property changes (#3872)

* Listen for dbus property changes

* Avoid remaking dbus proxy objects

* proper snake case for pylint

* some cleanup and more tests
This commit is contained in:
Mike Degatano
2022-09-17 03:55:41 -04:00
committed by GitHub
parent 0b09eb3659
commit 99bc201688
54 changed files with 1207 additions and 444 deletions

View File

@@ -1,4 +1,5 @@
"""Test NetwrokInterface."""
import asyncio
from ipaddress import IPv4Address, IPv4Interface, IPv6Address, IPv6Interface
import pytest
@@ -6,6 +7,7 @@ import pytest
from supervisor.dbus.const import DeviceType, InterfaceMethod
from supervisor.dbus.network import NetworkManager
from tests.common import fire_property_change_signal
from tests.const import TEST_INTERFACE, TEST_INTERFACE_WLAN
@@ -40,6 +42,14 @@ async def test_network_interface_ethernet(network_manager: NetworkManager):
assert interface.settings.ipv6.method == InterfaceMethod.AUTO
assert interface.settings.connection.id == "Wired connection 1"
fire_property_change_signal(interface.connection, {"State": 4})
await asyncio.sleep(0)
assert interface.connection.state == 4
fire_property_change_signal(interface.connection, {}, ["State"])
await asyncio.sleep(0)
assert interface.connection.state == 2
@pytest.mark.asyncio
async def test_network_interface_wlan(network_manager: NetworkManager):