def test_device_wifi_parse(): d1 = '* AP1 Infra 1 130 Mbit/s 82 ______ WPA1 WPA2' assert DeviceWifi.parse(d1) == \ DeviceWifi(True, 'AP1', 'Infra', 1, 130, 82, 'WPA1 WPA2') d2 = ' AP1 Infra 1 130 Mbit/s 82 ______ WPA1 WPA2' assert DeviceWifi.parse(d2) == \ DeviceWifi(False, 'AP1', 'Infra', 1, 130, 82, 'WPA1 WPA2')
def test_device_wifi_parse(): d1 = '*:AP1:Infra:1:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d1) == \ DeviceWifi(True, 'AP1', 'Infra', 1, 130, 82, 'WPA1 WPA2') d2 = ' :AP1:Infra:1:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d2) == \ DeviceWifi(False, 'AP1', 'Infra', 1, 130, 82, 'WPA1 WPA2') d3 = ' :AP 1:Infra:1:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d3) == \ DeviceWifi(False, 'AP 1', 'Infra', 1, 130, 82, 'WPA1 WPA2') d4 = ' :AAAAAA BBBBBBBBB CCC 9999:Infra:1:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d4) == \ DeviceWifi(False, 'AAAAAA BBBBBBBBB CCC 9999', 'Infra', 1, 130, 82, 'WPA1 WPA2')
def test_device_wifi_parse(): d1 = '*:AP1:00\\:00\\:00\\:00\\:00\\:00:Infra:1:2400 MHz:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d1) == \ DeviceWifi(True, 'AP1', '00:00:00:00:00:00', 'Infra', 1, 2400, 130, 82, 'WPA1 WPA2') d2 = ' :AP1:00\\:00\\:00\\:00\\:00\\:01:Infra:1:2401 MHz:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d2) == \ DeviceWifi(False, 'AP1', '00:00:00:00:00:01', 'Infra', 1, 2401, 130, 82, 'WPA1 WPA2') d3 = ' :AP 1:00\\:00\\:00\\:00\\:00\\:02:Infra:1:2402 MHz:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d3) == \ DeviceWifi(False, 'AP 1', '00:00:00:00:00:02', 'Infra', 1, 2402, 130, 82, 'WPA1 WPA2') d4 = ' :AAAAAA BBBBBBBBB CCC 9999:00\\:00\\:00\\:00\\:00\\:03:Infra:1:2403 MHz:130 Mbit/s:82:WPA1 WPA2' assert DeviceWifi.parse(d4) == \ DeviceWifi(False, 'AAAAAA BBBBBBBBB CCC 9999', '00:00:00:00:00:03', 'Infra', 1, 2403, 130, 82, 'WPA1 WPA2')
def test_device_wifi_parse_when_failed(): d = '*:AP1:Infra:1:130 Mbit/s:82:WPA1 WPA2' with pytest.raises(ValueError) as e: DeviceWifi.parse(d) assert str(e.value) == f'Parse failed [{d}]'