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:
40
tests/dbus_service_mocks/agent_apparmor.py
Normal file
40
tests/dbus_service_mocks/agent_apparmor.py
Normal 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
|
||||
Reference in New Issue
Block a user