diff --git a/autotests/testSAE/autoconnect_test.py b/autotests/testSAE/autoconnect_test.py index fa912ec4..a1d77787 100644 --- a/autotests/testSAE/autoconnect_test.py +++ b/autotests/testSAE/autoconnect_test.py @@ -11,8 +11,7 @@ from iwd import NetworkType class Test(unittest.TestCase): - def test_connection_success(self): - wd = IWD(True) + def validate_connection(self, wd): devices = wd.list_devices(4) self.assertIsNotNone(devices) @@ -46,7 +45,13 @@ class Test(unittest.TestCase): condition = 'not obj.connected' wd.wait_for_object_condition(ordered_network.network_object, condition) - del wd + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + finally: + del wd @classmethod def setUpClass(cls): diff --git a/autotests/testSAE/clogging_test.py b/autotests/testSAE/clogging_test.py index 6b64998a..5c31a8c7 100644 --- a/autotests/testSAE/clogging_test.py +++ b/autotests/testSAE/clogging_test.py @@ -11,11 +11,9 @@ from iwd import NetworkType class Test(unittest.TestCase): - def test_connection_success(self): + def validate_connection(self, wd): networks = [] - wd = IWD(True) - psk_agent = PSKAgent(["secret123"] * 4) wd.register_psk_agent(psk_agent) @@ -61,7 +59,13 @@ class Test(unittest.TestCase): wd.unregister_psk_agent(psk_agent) - del wd + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + finally: + del wd @classmethod def setUpClass(cls): diff --git a/autotests/testSAE/connection_test.py b/autotests/testSAE/connection_test.py index 9bf61db1..b55b2904 100644 --- a/autotests/testSAE/connection_test.py +++ b/autotests/testSAE/connection_test.py @@ -13,15 +13,13 @@ import testutil class Test(unittest.TestCase): - def test_connection_success(self): + def validate_connection(self, wd): hostapd_if = None for hostapd in list(hostapd_map.values()): if hostapd.config == 'ssidSAE.conf': hostapd_if = hostapd.name - wd = IWD(True) - psk_agent = PSKAgent("secret123") wd.register_psk_agent(psk_agent) @@ -67,7 +65,13 @@ class Test(unittest.TestCase): wd.unregister_psk_agent(psk_agent) - del wd + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + finally: + del wd @classmethod def setUpClass(cls): diff --git a/autotests/testSAE/failure_test.py b/autotests/testSAE/failure_test.py index 9fe756e7..019fe7da 100644 --- a/autotests/testSAE/failure_test.py +++ b/autotests/testSAE/failure_test.py @@ -11,8 +11,7 @@ from iwd import NetworkType class Test(unittest.TestCase): - def test_connection_success(self): - wd = IWD(True) + def validate_connection(self, wd): psk_agent = PSKAgent("InvalidSecret") wd.register_psk_agent(psk_agent) @@ -41,7 +40,13 @@ class Test(unittest.TestCase): wd.unregister_psk_agent(psk_agent) - del wd + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + finally: + del wd @classmethod def setUpClass(cls): diff --git a/autotests/testSAE/group_20_connection_test.py b/autotests/testSAE/group_20_connection_test.py index 5f555622..351261be 100644 --- a/autotests/testSAE/group_20_connection_test.py +++ b/autotests/testSAE/group_20_connection_test.py @@ -13,15 +13,13 @@ import testutil class Test(unittest.TestCase): - def test_connection_success(self): + def validate_connection(self, wd): hostapd_if = None for hostapd in list(hostapd_map.values()): if hostapd.config == 'ssidSAE-20.conf': hostapd_if = hostapd.name - wd = IWD(True) - psk_agent = PSKAgent("secret123") wd.register_psk_agent(psk_agent) @@ -67,7 +65,13 @@ class Test(unittest.TestCase): wd.unregister_psk_agent(psk_agent) - del wd + def test_connection_success(self): + wd = IWD(True) + + try: + self.validate_connection(wd) + finally: + del wd @classmethod def setUpClass(cls):