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
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""Mock of Network Manager DNS Manager service."""
|
|
|
|
from dbus_fast import Variant
|
|
from dbus_fast.service import PropertyAccess, dbus_property
|
|
|
|
from .base import DBusServiceMock
|
|
|
|
BUS_NAME = "org.freedesktop.NetworkManager"
|
|
|
|
|
|
def setup(object_path: str | None = None) -> DBusServiceMock:
|
|
"""Create dbus mock object."""
|
|
return DnsManager()
|
|
|
|
|
|
class DnsManager(DBusServiceMock):
|
|
"""DNS Manager mock.
|
|
|
|
gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/DnsManager
|
|
"""
|
|
|
|
interface = "org.freedesktop.NetworkManager.DnsManager"
|
|
object_path = "/org/freedesktop/NetworkManager/DnsManager"
|
|
|
|
@dbus_property(access=PropertyAccess.READ)
|
|
def Mode(self) -> "s":
|
|
"""Get Mode."""
|
|
return "default"
|
|
|
|
@dbus_property(access=PropertyAccess.READ)
|
|
def RcManager(self) -> "s":
|
|
"""Get RcManager."""
|
|
return "file"
|
|
|
|
@dbus_property(access=PropertyAccess.READ)
|
|
def Configuration(self) -> "aa{sv}":
|
|
"""Get Configuration."""
|
|
return [
|
|
{
|
|
"nameservers": Variant("as", ["192.168.30.1"]),
|
|
"domains": Variant("as", ["syshack.ch"]),
|
|
"interface": Variant("s", "eth0"),
|
|
"priority": Variant("i", 100),
|
|
"vpn": Variant("b", False),
|
|
}
|
|
]
|