mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 02:49:43 +00:00
@@ -404,6 +404,54 @@ def test_networkmanager_binary_data():
|
||||
]
|
||||
|
||||
|
||||
def test_networkmanager_binary_string_data():
|
||||
"""Test NetworkManager Binary string datastrings."""
|
||||
raw = "({'802-11-wireless': {'mac-address-blacklist': <@as []>, 'mac-address': <b'*~_\\\\035\\\\311'>, 'mode': <'infrastructure'>, 'security': <'802-11-wireless-security'>, 'seen-bssids': <['7C:2E:BD:98:1B:06']>, 'ssid': <[byte 0x4e, 0x45, 0x54, 0x54]>}, 'connection': {'id': <'NETT'>, 'interface-name': <'wlan0'>, 'permissions': <@as []>, 'timestamp': <uint64 1598526799>, 'type': <'802-11-wireless'>, 'uuid': <'13f9af79-a6e9-4e07-9353-165ad57bf1a8'>}, 'ipv6': {'address-data': <@aa{sv} []>, 'addresses': <@a(ayuay) []>, 'dns': <@aay []>, 'dns-search': <@as []>, 'method': <'auto'>, 'route-data': <@aa{sv} []>, 'routes': <@a(ayuayu) []>}, '802-11-wireless-security': {'auth-alg': <'open'>, 'key-mgmt': <'wpa-psk'>}, 'ipv4': {'address-data': <@aa{sv} []>, 'addresses': <@aau []>, 'dns': <@au []>, 'dns-search': <@as []>, 'method': <'auto'>, 'route-data': <@aa{sv} []>, 'routes': <@aau []>}, 'proxy': {}},)"
|
||||
|
||||
data = DBus.parse_gvariant(raw)
|
||||
|
||||
assert data == [
|
||||
{
|
||||
"802-11-wireless": {
|
||||
"mac-address": [42, 126, 95, 29, 195, 137],
|
||||
"mac-address-blacklist": [],
|
||||
"mode": "infrastructure",
|
||||
"security": "802-11-wireless-security",
|
||||
"seen-bssids": ["7C:2E:BD:98:1B:06"],
|
||||
"ssid": [78, 69, 84, 84],
|
||||
},
|
||||
"802-11-wireless-security": {"auth-alg": "open", "key-mgmt": "wpa-psk"},
|
||||
"connection": {
|
||||
"id": "NETT",
|
||||
"interface-name": "wlan0",
|
||||
"permissions": [],
|
||||
"timestamp": 1598526799,
|
||||
"type": "802-11-wireless",
|
||||
"uuid": "13f9af79-a6e9-4e07-9353-165ad57bf1a8",
|
||||
},
|
||||
"ipv4": {
|
||||
"address-data": [],
|
||||
"addresses": [],
|
||||
"dns": [],
|
||||
"dns-search": [],
|
||||
"method": "auto",
|
||||
"route-data": [],
|
||||
"routes": [],
|
||||
},
|
||||
"ipv6": {
|
||||
"address-data": [],
|
||||
"addresses": [],
|
||||
"dns": [],
|
||||
"dns-search": [],
|
||||
"method": "auto",
|
||||
"route-data": [],
|
||||
"routes": [],
|
||||
},
|
||||
"proxy": {},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_v6():
|
||||
"""Test IPv6 Property."""
|
||||
raw = "({'addresses': <[([byte 0x20, 0x01, 0x04, 0x70, 0x79, 0x2d, 0x00, 0x01, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10], uint32 64, [byte 0x20, 0x01, 0x04, 0x70, 0x79, 0x2d, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01])]>, 'dns': <[[byte 0x20, 0x01, 0x04, 0x70, 0x79, 0x2d, 0x00, 0x01, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05]]>})"
|
||||
|
||||
Reference in New Issue
Block a user