diff mbox series

[RFC,4/4] auto-t: add a few more DPP tests for seen/known networks

Message ID 20231213172546.145998-5-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series Fix extra settings not being taken post-DPP | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Dec. 13, 2023, 5:25 p.m. UTC
These ensure DPP works correctly when a network has already been seen
in the scan results as well as if its a known network.
---
 autotests/testDPP/pkex_test.py | 40 ++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
diff mbox series

Patch

diff --git a/autotests/testDPP/pkex_test.py b/autotests/testDPP/pkex_test.py
index 9e0b5dd8..07def453 100644
--- a/autotests/testDPP/pkex_test.py
+++ b/autotests/testDPP/pkex_test.py
@@ -186,6 +186,46 @@  class Test(unittest.TestCase):
 
         self.agent = None
 
+    def test_network_seen_before_dpp(self):
+        self.start_iwd_pkex_configurator(self.device[0])
+
+        # Scan first so a network object already exists
+        self.device[1].scan()
+        self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
+        self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
+
+        self.device[1].dpp_pkex_enroll('secret123', identifier="test")
+
+        condition = 'obj.state == DeviceState.connected'
+        self.wd.wait_for_object_condition(self.device[1], condition)
+
+        # Check additional settings were carried over
+        with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
+            settings = f.read()
+
+        self.assertIn("SendHostname=true", settings)
+
+    def test_existing_known_network(self):
+        # Copy an invalid profile, make sure DPP overwrites it and connects
+        IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidCCMP.psk")
+        self.start_iwd_pkex_configurator(self.device[0])
+
+        # Scan first so a network object exists, and its a known network
+        self.device[1].scan()
+        self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
+        self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
+
+        self.device[1].dpp_pkex_enroll('secret123', identifier="test")
+
+        condition = 'obj.state == DeviceState.connected'
+        self.wd.wait_for_object_condition(self.device[1], condition)
+
+        # Check additional settings were carried over
+        with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
+            settings = f.read()
+
+        self.assertIn("SendHostname=true", settings)
+
     def setUp(self):
         ns0 = ctx.get_namespace('ns0')
         self.wpas = Wpas('wpas.conf')