Update tailscale to 0.6.0 (#103409)

pull/103535/head
Franck Nijhof 2023-11-06 11:12:33 +01:00 committed by GitHub
parent 6d567c3e0a
commit cee8379628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 95 deletions

View File

@ -32,5 +32,5 @@ async def async_get_config_entry_diagnostics(
"""Return diagnostics for a config entry."""
coordinator: TailscaleDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
# Round-trip via JSON to trigger serialization
devices = [json.loads(device.json()) for device in coordinator.data.values()]
devices = [json.loads(device.to_json()) for device in coordinator.data.values()]
return async_redact_data({"devices": devices}, TO_REDACT)

View File

@ -7,5 +7,5 @@
"integration_type": "hub",
"iot_class": "cloud_polling",
"quality_scale": "platinum",
"requirements": ["tailscale==0.2.0"]
"requirements": ["tailscale==0.6.0"]
}

View File

@ -2539,7 +2539,7 @@ synology-srm==0.2.0
systembridgeconnector==3.8.4
# homeassistant.components.tailscale
tailscale==0.2.0
tailscale==0.6.0
# homeassistant.components.tank_utility
tank-utility==1.5.0

View File

@ -1893,7 +1893,7 @@ switchbot-api==1.2.1
systembridgeconnector==3.8.4
# homeassistant.components.tailscale
tailscale==0.2.0
tailscale==0.6.0
# homeassistant.components.tellduslive
tellduslive==0.10.11

View File

@ -41,7 +41,7 @@ def mock_tailscale_config_flow() -> Generator[None, MagicMock, None]:
"homeassistant.components.tailscale.config_flow.Tailscale", autospec=True
) as tailscale_mock:
tailscale = tailscale_mock.return_value
tailscale.devices.return_value = Devices.parse_raw(
tailscale.devices.return_value = Devices.from_json(
load_fixture("tailscale/devices.json")
).devices
yield tailscale
@ -54,7 +54,7 @@ def mock_tailscale(request: pytest.FixtureRequest) -> Generator[None, MagicMock,
if hasattr(request, "param") and request.param:
fixture = request.param
devices = Devices.parse_raw(load_fixture(fixture)).devices
devices = Devices.from_json(load_fixture(fixture)).devices
with patch(
"homeassistant.components.tailscale.coordinator.Tailscale", autospec=True
) as tailscale_mock:

View File

@ -0,0 +1,87 @@
# serializer version: 1
# name: test_diagnostics
dict({
'devices': list([
dict({
'addresses': '**REDACTED**',
'advertised_routes': list([
]),
'authorized': True,
'blocks_incoming_connections': False,
'client_connectivity': dict({
'client_supports': dict({
'hair_pinning': False,
'ipv6': False,
'pcp': False,
'pmp': False,
'udp': True,
'upnp': False,
}),
'endpoints': '**REDACTED**',
'mapping_varies_by_dest_ip': False,
}),
'client_version': '1.12.3-td91ea7286-ge1bbbd90c',
'created': '2021-08-19T09:25:22+00:00',
'device_id': '**REDACTED**',
'enabled_routes': list([
]),
'expires': '2022-02-15T09:25:22+00:00',
'hostname': '**REDACTED**',
'is_external': False,
'key_expiry_disabled': False,
'last_seen': '2021-09-16T06:11:23+00:00',
'machine_key': '**REDACTED**',
'name': '**REDACTED**',
'node_key': '**REDACTED**',
'os': 'iOS',
'tags': list([
]),
'update_available': True,
'user': '**REDACTED**',
}),
dict({
'addresses': '**REDACTED**',
'advertised_routes': list([
'0.0.0.0/0',
'10.10.10.0/23',
'::/0',
]),
'authorized': True,
'blocks_incoming_connections': False,
'client_connectivity': dict({
'client_supports': dict({
'hair_pinning': True,
'ipv6': False,
'pcp': False,
'pmp': False,
'udp': True,
'upnp': False,
}),
'endpoints': '**REDACTED**',
'mapping_varies_by_dest_ip': False,
}),
'client_version': '1.14.0-t5cff36945-g809e87bba',
'created': '2021-08-29T09:49:06+00:00',
'device_id': '**REDACTED**',
'enabled_routes': list([
'0.0.0.0/0',
'10.10.10.0/23',
'::/0',
]),
'expires': '2022-02-25T09:49:06+00:00',
'hostname': '**REDACTED**',
'is_external': False,
'key_expiry_disabled': False,
'last_seen': '2021-11-15T20:37:03+00:00',
'machine_key': '**REDACTED**',
'name': '**REDACTED**',
'node_key': '**REDACTED**',
'os': 'linux',
'tags': list([
]),
'update_available': True,
'user': '**REDACTED**',
}),
]),
})
# ---

View File

@ -1,6 +1,6 @@
"""Tests for the diagnostics data provided by the Tailscale integration."""
from syrupy import SnapshotAssertion
from homeassistant.components.diagnostics import REDACTED
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@ -12,93 +12,10 @@ async def test_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
init_integration: MockConfigEntry,
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics."""
assert await get_diagnostics_for_config_entry(
hass, hass_client, init_integration
) == {
"devices": [
{
"addresses": REDACTED,
"device_id": REDACTED,
"user": REDACTED,
"name": REDACTED,
"hostname": REDACTED,
"client_version": "1.12.3-td91ea7286-ge1bbbd90c",
"update_available": True,
"os": "iOS",
"created": "2021-08-19T09:25:22+00:00",
"last_seen": "2021-09-16T06:11:23+00:00",
"key_expiry_disabled": False,
"expires": "2022-02-15T09:25:22+00:00",
"authorized": True,
"is_external": False,
"machine_key": REDACTED,
"node_key": REDACTED,
"blocks_incoming_connections": False,
"enabled_routes": [],
"advertised_routes": [],
"client_connectivity": {
"endpoints": REDACTED,
"derp": "",
"mapping_varies_by_dest_ip": False,
"latency": {},
"client_supports": {
"hair_pinning": False,
"ipv6": False,
"pcp": False,
"pmp": False,
"udp": True,
"upnp": False,
},
},
},
{
"addresses": REDACTED,
"device_id": REDACTED,
"user": REDACTED,
"name": REDACTED,
"hostname": REDACTED,
"client_version": "1.14.0-t5cff36945-g809e87bba",
"update_available": True,
"os": "linux",
"created": "2021-08-29T09:49:06+00:00",
"last_seen": "2021-11-15T20:37:03+00:00",
"key_expiry_disabled": False,
"expires": "2022-02-25T09:49:06+00:00",
"authorized": True,
"is_external": False,
"machine_key": REDACTED,
"node_key": REDACTED,
"blocks_incoming_connections": False,
"enabled_routes": ["0.0.0.0/0", "10.10.10.0/23", "::/0"],
"advertised_routes": ["0.0.0.0/0", "10.10.10.0/23", "::/0"],
"client_connectivity": {
"endpoints": REDACTED,
"derp": "",
"mapping_varies_by_dest_ip": False,
"latency": {
"Bangalore": {"latencyMs": 143.42505599999998},
"Chicago": {"latencyMs": 101.123646},
"Dallas": {"latencyMs": 136.85886},
"Frankfurt": {"latencyMs": 18.968314},
"London": {"preferred": True, "latencyMs": 14.314574},
"New York City": {"latencyMs": 83.078912},
"San Francisco": {"latencyMs": 148.215522},
"Seattle": {"latencyMs": 181.553595},
"Singapore": {"latencyMs": 164.566539},
"São Paulo": {"latencyMs": 207.250179},
"Tokyo": {"latencyMs": 226.90714300000002},
},
"client_supports": {
"hair_pinning": True,
"ipv6": False,
"pcp": False,
"pmp": False,
"udp": True,
"upnp": False,
},
},
},
]
}
assert (
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
== snapshot
)