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'.
44 lines
899 B
Python
44 lines
899 B
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 test_push_button_success(self):
|
|
wd = IWD()
|
|
|
|
devices = wd.list_devices(1)
|
|
device = devices[0]
|
|
|
|
device.wps_push_button()
|
|
|
|
condition = 'obj.state == DeviceState.connected'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
device.disconnect()
|
|
|
|
condition = 'obj.state == DeviceState.disconnected'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.hostapd = HostapdCLI(config='ssid-wps-small-mtu.conf')
|
|
|
|
cls.hostapd.wps_push_button()
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
IWD.clear_storage()
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(exit=True)
|