mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 10:59:43 +00: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:
@@ -1,4 +1,5 @@
|
||||
"""Test Datadisk/Agent dbus interface."""
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -6,6 +7,8 @@ import pytest
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.exceptions import DBusNotConnectedError
|
||||
|
||||
from tests.common import fire_property_change_signal
|
||||
|
||||
|
||||
async def test_dbus_osagent_datadisk(coresys: CoreSys):
|
||||
"""Test coresys dbus connection."""
|
||||
@@ -16,6 +19,16 @@ async def test_dbus_osagent_datadisk(coresys: CoreSys):
|
||||
|
||||
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda"
|
||||
|
||||
fire_property_change_signal(
|
||||
coresys.dbus.agent.datadisk, {"CurrentDevice": "/dev/sda1"}
|
||||
)
|
||||
await asyncio.sleep(0)
|
||||
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda1"
|
||||
|
||||
fire_property_change_signal(coresys.dbus.agent.datadisk, {}, ["CurrentDevice"])
|
||||
await asyncio.sleep(0)
|
||||
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda"
|
||||
|
||||
|
||||
async def test_dbus_osagent_datadisk_change_device(coresys: CoreSys, dbus: list[str]):
|
||||
"""Change datadisk on device."""
|
||||
|
||||
Reference in New Issue
Block a user