1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Use session dbus mocks for all tests (#4198)

* Use session dbus mocks for all tests

* func instead of fn for pylint
This commit is contained in:
Mike Degatano
2023-03-21 02:30:31 -04:00
committed by GitHub
parent c6ddc8e427
commit a6caccd845
157 changed files with 685 additions and 6572 deletions

View File

@@ -0,0 +1,40 @@
"""Mock of OS Agent AppArmor 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 AppArmor()
# pylint: disable=invalid-name
class AppArmor(DBusServiceMock):
"""AppArmor mock.
gdbus introspect --system --dest io.hass.os --object-path /io/hass/os/AppArmor
"""
object_path = "/io/hass/os/AppArmor"
interface = "io.hass.os.AppArmor"
@dbus_property(access=PropertyAccess.READ)
def ParserVersion(self) -> "s":
"""Get ParserVersion."""
return "2.13.2"
@dbus_method()
def LoadProfile(self, arg_0: "s", arg_1: "s") -> "b":
"""Load profile."""
return True
@dbus_method()
def UnloadProfile(self, arg_0: "s", arg_1: "s") -> "b":
"""Unload profile."""
return True