diff mbox series

[3/7] auto-t: add client test to testEAP-WPS

Message ID 20220630180331.206419-3-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/7] auto-t: iwd.py: add DPP properties | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

James Prestwood June 30, 2022, 6:03 p.m. UTC
Tests iwctl functionality with wsc commands
---
 autotests/testEAP-WPS/four_digit_pin_test.py | 16 +++++++++++-----
 autotests/testEAP-WPS/push_button_test.py    | 17 ++++++++++++-----
 2 files changed, 23 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/autotests/testEAP-WPS/four_digit_pin_test.py b/autotests/testEAP-WPS/four_digit_pin_test.py
index 7bdb57cb..d30492fb 100644
--- a/autotests/testEAP-WPS/four_digit_pin_test.py
+++ b/autotests/testEAP-WPS/four_digit_pin_test.py
@@ -4,22 +4,23 @@  import unittest
 import sys
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
-from iwd import DeviceState
-
 from hostapd import HostapdCLI
+from config import ctx
 
 class Test(unittest.TestCase):
 
-    def four_digit_pin_success(self, wd):
+    def four_digit_pin_success(self, wd, client=False):
 
         devices = wd.list_devices(1)
         device = devices[0]
         pin = '1234'
         self.hostapd.wps_pin(pin)
 
-        device.wps_start_pin(pin)
+        if not client:
+            device.wps_start_pin(pin)
+        else:
+            ctx.start_process(['iwctl', 'wsc', device.name, 'start-user-pin', pin], check=True)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -36,6 +37,11 @@  class Test(unittest.TestCase):
 
         self.four_digit_pin_success(wd)
 
+    def test_client_four_digit_pin(self):
+        wd = IWD(True)
+
+        self.four_digit_pin_success(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         cls.hostapd = HostapdCLI(config='ssidWPS.conf')
diff --git a/autotests/testEAP-WPS/push_button_test.py b/autotests/testEAP-WPS/push_button_test.py
index 08463f15..e2b4c2b2 100644
--- a/autotests/testEAP-WPS/push_button_test.py
+++ b/autotests/testEAP-WPS/push_button_test.py
@@ -4,20 +4,22 @@  import unittest
 import sys
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
-from iwd import DeviceState
-
 from hostapd import HostapdCLI
+from config import ctx
+
 class Test(unittest.TestCase):
 
-    def push_button_success(self, wd):
+    def push_button_success(self, wd, client=False):
         self.hostapd.wps_push_button()
 
         devices = wd.list_devices(1)
         device = devices[0]
 
-        device.wps_push_button()
+        if not client:
+            device.wps_push_button()
+        else:
+            ctx.start_process(['iwctl', 'wsc', device.name, 'push-button'], check=True)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -34,6 +36,11 @@  class Test(unittest.TestCase):
 
         self.push_button_success(wd)
 
+    def test_client_push_button(self):
+        wd = IWD(True)
+
+        self.push_button_success(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         cls.hostapd = HostapdCLI(config='ssidWPS.conf')