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
42 lines
992 B
Python
42 lines
992 B
Python
"""Mock of OS Agent DataDisk dbus service."""
|
|
|
|
from dbus_fast.service import PropertyAccess, dbus_property
|
|
|
|
from .base import DBusServiceMock, dbus_method
|
|
|
|
BUS_NAME = "io.hass.os"
|
|
|
|
|
|
def setup(object_path: str | None = None) -> DBusServiceMock:
|
|
"""Create dbus mock object."""
|
|
return DataDisk()
|
|
|
|
|
|
class DataDisk(DBusServiceMock):
|
|
"""DataDisk mock.
|
|
|
|
gdbus introspect --system --dest io.hass.os --object-path /io/hass/os/DataDisk
|
|
"""
|
|
|
|
object_path = "/io/hass/os/DataDisk"
|
|
interface = "io.hass.os.DataDisk"
|
|
|
|
@dbus_property(access=PropertyAccess.READ)
|
|
def CurrentDevice(self) -> "s":
|
|
"""Get Current Device."""
|
|
return "/dev/mmcblk1"
|
|
|
|
@dbus_method()
|
|
def ChangeDevice(self, arg_0: "s") -> "b":
|
|
"""Change device."""
|
|
return True
|
|
|
|
@dbus_method()
|
|
def ReloadDevice(self) -> "b":
|
|
"""Reload device."""
|
|
return True
|
|
|
|
@dbus_method()
|
|
def MarkDataMove(self) -> None:
|
|
"""Do MarkDataMove method."""
|