diff options
author | Tim Kourt <tim.a.kourt@linux.intel.com> | 2020-04-13 18:16:43 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-04-09 16:46:31 -0500 |
commit | d3339ddb723c2cccf346f6b0b9b43c311271520c (patch) | |
tree | cfa5e5f93f91c23f82c3972b128b6376b94bd14d | |
parent | 104e6898ca3e79d98439e45994fde12a521d7c93 (diff) | |
download | iwd-d3339ddb723c2cccf346f6b0b9b43c311271520c.tar.gz |
auto-t: Use proper connection status indicator
'Connected' property of the network object is set before the connection
attempt is made and does not indicate a connection success. Therefore,
use device status property to identify the connection status of the device.
-rw-r--r-- | autotests/testHotspot/autoconnect_test.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/autotests/testHotspot/autoconnect_test.py b/autotests/testHotspot/autoconnect_test.py index 36ba92bf4..936373f15 100644 --- a/autotests/testHotspot/autoconnect_test.py +++ b/autotests/testHotspot/autoconnect_test.py @@ -40,10 +40,8 @@ class Test(unittest.TestCase): # while there are hotspot networks in range. This should result in # autoconnect *after* ANQP is performed # - condition = 'obj.connected' - wd.wait_for_object_condition(wpa_network.network_object, condition) - - sleep(2) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd_wpa.ifname) @@ -53,10 +51,10 @@ class Test(unittest.TestCase): # os.remove("/var/lib/iwd/ssidWPA2-1.psk") - self.assertEqual(len(wd.list_known_networks()), 1) + condition = 'obj.state == DeviceState.disconnected' + wd.wait_for_object_condition(device, condition) - condition = 'not obj.connected' - wd.wait_for_object_condition(wpa_network.network_object, condition) + self.assertEqual(len(wd.list_known_networks()), 1) condition = 'obj.scanning' wd.wait_for_object_condition(device, condition) @@ -71,10 +69,8 @@ class Test(unittest.TestCase): # Since there are no other provisioned networks, we should do ANQP and # autoconnect to the hotspot network. # - condition = 'obj.connected' - wd.wait_for_object_condition(hotspot_network.network_object, condition) - - sleep(2) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd_hotspot.ifname) @@ -87,8 +83,8 @@ class Test(unittest.TestCase): # # make sure removal of hotspot conf file resulted in disconnect # - condition = 'not obj.connected' - wd.wait_for_object_condition(wpa_network.network_object, condition) + condition = 'obj.state == DeviceState.disconnected' + wd.wait_for_object_condition(device, condition) condition = 'obj.scanning' wd.wait_for_object_condition(device, condition) @@ -99,14 +95,14 @@ class Test(unittest.TestCase): hotspot_network = device.get_ordered_network("ssidWPA2-1") self.assertEqual(hotspot_network.type, NetworkType.psk) - condition = 'obj.connected' - wd.wait_for_object_condition(hotspot_network.network_object, condition) - - sleep(2) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd_wpa.ifname) + device.disconnect() + @classmethod def setUpClass(cls): IWD.copy_to_hotspot('autoconnect.conf') |