Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH v3 1/3] auto-t: Use proper connection status indicator
Date: Mon, 13 Apr 2020 18:16:43 -0700	[thread overview]
Message-ID: <20200414011645.22321-1-tim.a.kourt@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3501 bytes --]

'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.
---
 autotests/testHotspot/autoconnect_test.py | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/autotests/testHotspot/autoconnect_test.py b/autotests/testHotspot/autoconnect_test.py
index 36ba92bf..936373f1 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')
-- 
2.13.6

             reply	other threads:[~2020-04-14  1:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  1:16 Tim Kourt [this message]
2020-04-14  1:16 ` [PATCH v3 2/3] auto-t: Remove unused imports Tim Kourt
2020-04-14  1:16 ` [PATCH v3 3/3] auto-t: Fix event order Tim Kourt
2020-04-14 16:21 ` [PATCH v3 1/3] auto-t: Use proper connection status indicator Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200414011645.22321-1-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox