From 664cf5a368c2d77489a3eea5d20be6856b3ce20b Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Fri, 15 Mar 2019 15:02:48 -0700 Subject: [PATCH] auto-t: TTLS-MSCHAPv2 - remove iwd instance on failure --- autotests/testEAP-TTLS-MSCHAPv2/connection_test.py | 12 ++++++++---- autotests/testEAP-TTLS-MSCHAPv2/failure_test.py | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/autotests/testEAP-TTLS-MSCHAPv2/connection_test.py b/autotests/testEAP-TTLS-MSCHAPv2/connection_test.py index da00e609..3182bda3 100644 --- a/autotests/testEAP-TTLS-MSCHAPv2/connection_test.py +++ b/autotests/testEAP-TTLS-MSCHAPv2/connection_test.py @@ -15,7 +15,7 @@ from hostapd import hostapd_map class Test(unittest.TestCase): - def test_connection_success(self): + def validate_connection(self, wd): hostapd = None for hostapd_if in list(hostapd_map.values()): @@ -26,8 +26,6 @@ class Test(unittest.TestCase): self.assertIsNotNone(hostapd) - wd = IWD(True) - psk_agent = PSKAgent('abc', ('domain\\user', 'testpasswd')) wd.register_psk_agent(psk_agent) @@ -72,7 +70,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/testEAP-TTLS-MSCHAPv2/failure_test.py b/autotests/testEAP-TTLS-MSCHAPv2/failure_test.py index 1d7d62f6..c91ce3c9 100644 --- a/autotests/testEAP-TTLS-MSCHAPv2/failure_test.py +++ b/autotests/testEAP-TTLS-MSCHAPv2/failure_test.py @@ -15,7 +15,7 @@ from hostapd import hostapd_map class Test(unittest.TestCase): - def test_connection_failure(self): + def validate_connection(self, wd): hostapd = None for hostapd_if in list(hostapd_map.values()): @@ -26,8 +26,6 @@ class Test(unittest.TestCase): self.assertIsNotNone(hostapd) - wd = IWD(True) - psk_agent = PSKAgent('abc', ('user', 'incorrect_password')) wd.register_psk_agent(psk_agent) @@ -55,7 +53,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):