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

James Prestwood
2023-12-13T17:26:06Z

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 --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')
--
2.34.1