mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-04-19 10:47:15 +00:00

* Migrate to Ruff for lint and format * Fix pylint issues * DBus property sets into normal awaitable methods * Fix tests relying on separate tasks in connect * Fixes from feedback
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Test System/Agent dbus interface."""
|
|
|
|
from dbus_fast.aio.message_bus import MessageBus
|
|
import pytest
|
|
|
|
from supervisor.dbus.agent import OSAgent
|
|
from supervisor.exceptions import DBusNotConnectedError
|
|
|
|
from tests.dbus_service_mocks.agent_system import System as SystemService
|
|
from tests.dbus_service_mocks.base import DBusServiceMock
|
|
|
|
|
|
@pytest.fixture(name="system_service", autouse=True)
|
|
async def fixture_system_service(
|
|
os_agent_services: dict[str, DBusServiceMock],
|
|
) -> SystemService:
|
|
"""Mock System dbus service."""
|
|
yield os_agent_services["agent_system"]
|
|
|
|
|
|
async def test_dbus_osagent_system_wipe(
|
|
system_service: SystemService, dbus_session_bus: MessageBus
|
|
):
|
|
"""Test wipe data partition on host."""
|
|
system_service.ScheduleWipeDevice.calls.clear()
|
|
os_agent = OSAgent()
|
|
|
|
with pytest.raises(DBusNotConnectedError):
|
|
await os_agent.system.schedule_wipe_device()
|
|
|
|
await os_agent.connect(dbus_session_bus)
|
|
|
|
assert await os_agent.system.schedule_wipe_device() is None
|
|
assert system_service.ScheduleWipeDevice.calls == [()]
|