diff mbox series

[2/7] auto-t: add client test to testKnownNetworks

Message ID 20220630180331.206419-2-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 known-networks command
---
 .../testKnownNetworks/known_network_test.py   | 23 +++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/autotests/testKnownNetworks/known_network_test.py b/autotests/testKnownNetworks/known_network_test.py
index 2bdcc955..a383e5ff 100644
--- a/autotests/testKnownNetworks/known_network_test.py
+++ b/autotests/testKnownNetworks/known_network_test.py
@@ -2,10 +2,11 @@ 
 
 import unittest
 import sys
+import subprocess
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
+from config import ctx
 
 class Test(unittest.TestCase):
 
@@ -70,8 +71,26 @@  class Test(unittest.TestCase):
 
         self.list_removal_and_addition(wd)
 
+    def test_client_known_networks(self):
+        networks = ['Hotspot Network', 'ssidOpen', 'ssidTKIP', 'ssidEAP-TLS']
+        wd = IWD(True)
+
+        iwctl = ctx.start_process(['iwctl', 'known-networks', 'list'], check=True)
+
+        for n in networks:
+            self.assertIn(n, iwctl.out)
+
+        for n in networks:
+            ctx.start_process(['iwctl', 'known-networks', n, 'show'], check=True)
+
+        networks.remove('ssidOpen')
+        ctx.start_process(['iwctl', 'known-networks', 'ssidOpen', 'forget'], check=True)
+
+        with self.assertRaises(subprocess.CalledProcessError):
+            ctx.start_process(['iwctl', 'known-networks', 'ssidOpen', 'show'], check=True)
+
     @classmethod
-    def setUpClass(cls):
+    def setUp(self):
         IWD.copy_to_storage('known_networks/ssidOpen.open')
         IWD.copy_to_storage('known_networks/ssidTKIP.psk')
         IWD.copy_to_storage('known_networks/ssidEAP-TLS.8021x')