diff mbox series

[4/7] auto-t: add client test to testAdHoc

Message ID 20220630180331.206419-4-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 ad-hoc commands
---
 autotests/testAdHoc/adhoc_test.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/autotests/testAdHoc/adhoc_test.py b/autotests/testAdHoc/adhoc_test.py
index 13c0c016..4c5d5023 100644
--- a/autotests/testAdHoc/adhoc_test.py
+++ b/autotests/testAdHoc/adhoc_test.py
@@ -2,16 +2,16 @@ 
 
 import unittest
 import sys
-import time
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
+from iwd import AdHocDevice
+from config import ctx
 import testutil
 
 class Test(unittest.TestCase):
 
-    def validate_connection(self, wd):
+    def validate_connection(self, wd, client=False):
         dev1, dev2 = wd.list_devices(2)
 
         self.assertIsNotNone(dev1)
@@ -22,7 +22,14 @@  class Test(unittest.TestCase):
         condition = 'obj.started == True'
         wd.wait_for_object_condition(adhoc1, condition)
 
-        adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
+        if not client:
+            adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
+        else:
+            ctx.start_process(['iwctl', 'device', dev2.name, 'set-property',
+                                'Mode', 'ad-hoc'], check=True)
+            ctx.start_process(['iwctl', 'ad-hoc', dev2.name, 'start',
+                                'AdHocNetwork', 'secret123'], check=True)
+            adhoc2 = AdHocDevice(dev2.device_path)
 
         condition = 'obj.started == True'
         wd.wait_for_object_condition(adhoc1, condition)
@@ -42,6 +49,10 @@  class Test(unittest.TestCase):
 
         self.validate_connection(wd)
 
+    def test_client_adhoc(self):
+        wd = IWD(True)
+        self.validate_connection(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         pass