mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
auto-t: Add scan test
This commit is contained in:
parent
9e851d7353
commit
3093e57715
7
autotests/testScan/hw.conf
Normal file
7
autotests/testScan/hw.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[SETUP]
|
||||
num_radios=4
|
||||
|
||||
[HOSTAPD]
|
||||
rad0=ssidOpen.conf
|
||||
rad1=ssidTKIP.conf
|
||||
rad2=ssidCCMP.conf
|
7
autotests/testScan/ssidCCMP.conf
Normal file
7
autotests/testScan/ssidCCMP.conf
Normal file
@ -0,0 +1,7 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidCCMP
|
||||
|
||||
wpa=2
|
||||
wpa_pairwise=CCMP
|
||||
wpa_passphrase=secret123
|
3
autotests/testScan/ssidOpen.conf
Normal file
3
autotests/testScan/ssidOpen.conf
Normal file
@ -0,0 +1,3 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidOpen
|
7
autotests/testScan/ssidTKIP.conf
Normal file
7
autotests/testScan/ssidTKIP.conf
Normal file
@ -0,0 +1,7 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidTKIP
|
||||
|
||||
wpa=1
|
||||
wpa_pairwise=TKIP
|
||||
wpa_passphrase=secret123
|
65
autotests/testScan/test.py
Normal file
65
autotests/testScan/test.py
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
from iwd import NetworkType
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_scan(self):
|
||||
wd = IWD()
|
||||
|
||||
devices = wd.list_devices();
|
||||
self.assertIsNotNone(devices)
|
||||
device = devices[0]
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
device.scan()
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
ordered_networks = device.get_ordered_networks()
|
||||
|
||||
seen = [0] * 3
|
||||
for o_n in ordered_networks:
|
||||
if o_n.name == "ssidOpen":
|
||||
self.assertEqual(o_n.type, NetworkType.open)
|
||||
if seen[0]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[0] = 1
|
||||
elif o_n.name == "ssidTKIP":
|
||||
self.assertEqual(o_n.type, NetworkType.psk)
|
||||
if seen[1]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[1] = 1
|
||||
elif o_n.name == "ssidCCMP":
|
||||
self.assertEqual(o_n.type, NetworkType.psk)
|
||||
if seen[2]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[2] = 1
|
||||
else:
|
||||
raise Exception()
|
||||
|
||||
for entry in seen:
|
||||
self.assertNotEqual(entry, 0)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
Loading…
Reference in New Issue
Block a user