dependabot[bot] 6042694d84
Bump dbus-fast from 2.45.1 to 3.1.2 (#6317)
* Bump dbus-fast from 2.45.1 to 3.1.2

Bumps [dbus-fast](https://github.com/bluetooth-devices/dbus-fast) from 2.45.1 to 3.1.2.
- [Release notes](https://github.com/bluetooth-devices/dbus-fast/releases)
- [Changelog](https://github.com/Bluetooth-Devices/dbus-fast/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluetooth-devices/dbus-fast/compare/v2.45.1...v3.1.2)

---
updated-dependencies:
- dependency-name: dbus-fast
  dependency-version: 3.1.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update unit tests for dbus-fast 3.1.2 changes

* Fix type annotations

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefan Agner <stefan@agner.ch>
2025-11-25 16:25:06 +01:00

226 lines
6.0 KiB
Python

"""Mock of resolved dbus service."""
from dbus_fast.service import PropertyAccess, dbus_property
from .base import DBusServiceMock
BUS_NAME = "org.freedesktop.resolve1"
def setup(object_path: str | None = None) -> DBusServiceMock:
"""Create dbus mock object."""
return Resolved()
class Resolved(DBusServiceMock):
"""Resolved mock.
gdbus introspect --system --dest org.freedesktop.resolve1 --object-path /org/freedesktop/resolve1
"""
object_path = "/org/freedesktop/resolve1"
interface = "org.freedesktop.resolve1.Manager"
@dbus_property(access=PropertyAccess.READ)
def LLMNRHostname(self) -> "s":
"""Get LLMNRHostname."""
return "homeassistant"
@dbus_property(access=PropertyAccess.READ)
def LLMNR(self) -> "s":
"""Get LLMNR."""
return "yes"
@dbus_property(access=PropertyAccess.READ)
def MulticastDNS(self) -> "s":
"""Get MulticastDNS."""
return "resolve"
@dbus_property(access=PropertyAccess.READ)
def DNSOverTLS(self) -> "s":
"""Get DNSOverTLS."""
return "no"
@dbus_property(access=PropertyAccess.READ)
def DNS(self) -> "a(iiay)":
"""Get DNS."""
return [
(0, 2, bytes([127, 0, 0, 1])),
(
0,
10,
bytes(
[
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x1,
]
),
),
]
@dbus_property(access=PropertyAccess.READ)
def DNSEx(self) -> "a(iiayqs)":
"""Get DNSEx."""
return [
(0, 2, bytes([127, 0, 0, 1]), 0, ""),
(
0,
10,
bytes(
[
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x1,
]
),
0,
"",
),
]
@dbus_property(access=PropertyAccess.READ)
def FallbackDNS(self) -> "a(iiay)":
"""Get FallbackDNS."""
return [
(0, 2, bytes([1, 1, 1, 1])),
(
0,
10,
bytes(
[
0x26,
0x6,
0x47,
0x0,
0x47,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x11,
0x11,
]
),
),
]
@dbus_property(access=PropertyAccess.READ)
def FallbackDNSEx(self) -> "a(iiayqs)":
"""Get FallbackDNSEx."""
return [
(0, 2, bytes([1, 1, 1, 1]), 0, "cloudflare-dns.com"),
(
0,
10,
bytes(
[
0x26,
0x6,
0x47,
0x0,
0x47,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x11,
0x11,
]
),
0,
"cloudflare-dns.com",
),
]
@dbus_property(access=PropertyAccess.READ)
def CurrentDNSServer(self) -> "(iiay)":
"""Get CurrentDNSServer."""
return (0, 2, bytes([127, 0, 0, 1]))
@dbus_property(access=PropertyAccess.READ)
def CurrentDNSServerEx(self) -> "(iiayqs)":
"""Get CurrentDNSServerEx."""
return (0, 2, bytes([127, 0, 0, 1]), 0, "")
@dbus_property(access=PropertyAccess.READ)
def Domains(self) -> "a(isb)":
"""Get Domains."""
return [(0, "local.hass.io", False)]
@dbus_property(access=PropertyAccess.READ)
def TransactionStatistics(self) -> "(tt)":
"""Get TransactionStatistics."""
return (0, 100000)
@dbus_property(access=PropertyAccess.READ)
def CacheStatistics(self) -> "(ttt)":
"""Get CacheStatistics."""
return (10, 50000, 10000)
@dbus_property(access=PropertyAccess.READ)
def DNSSEC(self) -> "s":
"""Get DNSSEC."""
return "no"
@dbus_property(access=PropertyAccess.READ)
def DNSSECStatistics(self) -> "(tttt)":
"""Get DNSSECStatistics."""
return (0, 0, 0, 0)
@dbus_property(access=PropertyAccess.READ)
def DNSSECSupported(self) -> "b":
"""Get DNSSECSupported."""
return False
@dbus_property(access=PropertyAccess.READ)
def DNSSECNegativeTrustAnchors(self) -> "as":
"""Get DNSSECNegativeTrustAnchors."""
return ["168.192.in-addr.arpa", "local"]
@dbus_property(access=PropertyAccess.READ)
def DNSStubListener(self) -> "s":
"""Get DNSStubListener."""
return "no"
@dbus_property(access=PropertyAccess.READ)
def ResolvConfMode(self) -> "s":
"""Get ResolvConfMode."""
return "foreign"