From 5bc6e986e4c17b8503fda88d79b0ec49f2c7b7f4 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Mon, 21 May 2018 13:35:02 -0700 Subject: [PATCH] auto-t: GTC 1) Renamed the test to reflect the usage of PEAP 2) Prevented the creation of an extra instance of iwd 3) Refactored to start catching the exceptions and properly dispose an instance of iwd 4) Switched to list_devices with wait option --- .../eap-user-peap-gtc.text | 0 .../{testEAP-GTC => testEAP-PEAP-GTC}/hw.conf | 4 +-- .../peap_gtc_test.py | 28 +++++++++---------- .../ssidEAP-PEAPv1-GTC.8021x | 0 .../ssidEAP-PEAPv1-GTC.conf | 0 5 files changed, 15 insertions(+), 17 deletions(-) rename autotests/{testEAP-GTC => testEAP-PEAP-GTC}/eap-user-peap-gtc.text (100%) rename autotests/{testEAP-GTC => testEAP-PEAP-GTC}/hw.conf (84%) rename autotests/{testEAP-GTC => testEAP-PEAP-GTC}/peap_gtc_test.py (79%) rename autotests/{testEAP-GTC => testEAP-PEAP-GTC}/ssidEAP-PEAPv1-GTC.8021x (100%) rename autotests/{testEAP-GTC => testEAP-PEAP-GTC}/ssidEAP-PEAPv1-GTC.conf (100%) diff --git a/autotests/testEAP-GTC/eap-user-peap-gtc.text b/autotests/testEAP-PEAP-GTC/eap-user-peap-gtc.text similarity index 100% rename from autotests/testEAP-GTC/eap-user-peap-gtc.text rename to autotests/testEAP-PEAP-GTC/eap-user-peap-gtc.text diff --git a/autotests/testEAP-GTC/hw.conf b/autotests/testEAP-PEAP-GTC/hw.conf similarity index 84% rename from autotests/testEAP-GTC/hw.conf rename to autotests/testEAP-PEAP-GTC/hw.conf index 36decf76..708317e9 100644 --- a/autotests/testEAP-GTC/hw.conf +++ b/autotests/testEAP-PEAP-GTC/hw.conf @@ -1,6 +1,6 @@ [SETUP] -num_radios=3 -start_iwd=1 +num_radios=2 +start_iwd=0 max_test_exec_interval_sec=60 tmpfs_extra_stuff=../misc/certs:eap-user-peap-gtc.text diff --git a/autotests/testEAP-GTC/peap_gtc_test.py b/autotests/testEAP-PEAP-GTC/peap_gtc_test.py similarity index 79% rename from autotests/testEAP-GTC/peap_gtc_test.py rename to autotests/testEAP-PEAP-GTC/peap_gtc_test.py index 51cfe54c..cfde2e02 100644 --- a/autotests/testEAP-GTC/peap_gtc_test.py +++ b/autotests/testEAP-PEAP-GTC/peap_gtc_test.py @@ -11,13 +11,8 @@ from iwd import NetworkType class Test(unittest.TestCase): - def test_connection_success(self): - ssid_to_connect = 'ssidEAP-PEAPv1-GTC' - - wd = IWD(True) - wd.wait(1) - - devices = wd.list_devices(); + def validate_connection(self, wd): + devices = wd.list_devices(True); self.assertIsNotNone(devices) device = devices[0] @@ -31,15 +26,9 @@ class Test(unittest.TestCase): wd.wait_for_object_condition(device, condition) ordered_networks = device.get_ordered_networks() - ordered_network = None - - for o_n in ordered_networks: - if o_n.name == ssid_to_connect: - ordered_network = o_n - break - - self.assertEqual(ordered_network.name, ssid_to_connect) + ordered_network = ordered_networks[0] + self.assertEqual(ordered_network.name, 'ssidEAP-PEAPv1-GTC') self.assertEqual(ordered_network.type, NetworkType.eap) condition = 'not obj.connected' @@ -55,6 +44,15 @@ class Test(unittest.TestCase): condition = 'not obj.connected' wd.wait_for_object_condition(ordered_network.network_object, condition) + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + except: + del wd + raise + del wd @classmethod diff --git a/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.8021x b/autotests/testEAP-PEAP-GTC/ssidEAP-PEAPv1-GTC.8021x similarity index 100% rename from autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.8021x rename to autotests/testEAP-PEAP-GTC/ssidEAP-PEAPv1-GTC.8021x diff --git a/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.conf b/autotests/testEAP-PEAP-GTC/ssidEAP-PEAPv1-GTC.conf similarity index 100% rename from autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.conf rename to autotests/testEAP-PEAP-GTC/ssidEAP-PEAPv1-GTC.conf