mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-02 10:09:23 +01:00
9594b03a35
The tests basically remained the same with a few minor changes. The wiphy_map and in turn hostapd_map are no longer used. This was already partially converted a long time ago when the 'config' parameter was added to HostapdCLI. This patch fully converts all autotests to use 'config' rather than looking up by interface. Some test scripts were named 'test.py' which was fine before but the new rewrite actually loads each python test as a module. The name 'test' is too ambiguous and causes issues due to a native python module with the same name. All of these files were renamed to 'connection_test.py'.
49 lines
1.0 KiB
Python
49 lines
1.0 KiB
Python
#!/usr/bin/python3
|
|
|
|
import unittest
|
|
import sys
|
|
|
|
sys.path.append('../util')
|
|
import iwd
|
|
from iwd import IWD
|
|
from iwd import DeviceState
|
|
|
|
from hostapd import HostapdCLI
|
|
|
|
class Test(unittest.TestCase):
|
|
|
|
def four_digit_pin_success(self, wd):
|
|
|
|
devices = wd.list_devices(1)
|
|
device = devices[0]
|
|
pin = '1234'
|
|
self.hostapd.wps_pin(pin)
|
|
|
|
device.wps_start_pin(pin)
|
|
|
|
condition = 'obj.state == DeviceState.connected'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
self.assertEqual(len(wd.list_known_networks()), 1)
|
|
|
|
device.disconnect()
|
|
|
|
condition = 'obj.state == DeviceState.disconnected'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
def test_connection_success(self):
|
|
wd = IWD(True)
|
|
|
|
self.four_digit_pin_success(wd)
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.hostapd = HostapdCLI(config='ssidWPS.conf')
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
IWD.clear_storage()
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(exit=True)
|