From d111e03035eaf0041b6f9f88aa46ba75d869fac2 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Mon, 21 May 2018 13:35:00 -0700 Subject: [PATCH] auto-t: MFP test 1) Switch to new Agent API 2) Refactored to start catching the exceptions and properly dispose an instance of iwd --- autotests/testMFP-Options/connection_test.py | 43 ++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/autotests/testMFP-Options/connection_test.py b/autotests/testMFP-Options/connection_test.py index 1f80cb87..f6058ea7 100644 --- a/autotests/testMFP-Options/connection_test.py +++ b/autotests/testMFP-Options/connection_test.py @@ -59,14 +59,13 @@ class TestMFP(unittest.TestCase): condition = 'not obj.connected' wd.wait_for_object_condition(ordered_network.network_object, condition) - def stage_iwd(self, config_dir): + IWD.clear_storage() - wd = IWD(True, config_dir) - - psk_agent = PSKAgent("secret123") + def stage_iwd(self, wd, config_dir): + psk_agent = PSKAgent( ['secret123', 'secret123', 'secret123'] ) wd.register_psk_agent(psk_agent) - devices = wd.list_devices(); + devices = wd.list_devices(True); self.assertIsNotNone(devices) device = devices[0] @@ -92,18 +91,38 @@ class TestMFP(unittest.TestCase): wd.unregister_psk_agent(psk_agent) + def test_iwd_mfp0(self): + wd = IWD(True, '/tmp/IWD-MFP0') + + try: + self.stage_iwd(wd, '/tmp/IWD-MFP0') + except: + del wd + raise + del wd - IWD.clear_storage() - - def test_iwd_mfp0(self): - self.stage_iwd('/tmp/IWD-MFP0') - def test_iwd_mfp1(self): - self.stage_iwd('/tmp/IWD-MFP1') + wd = IWD(True, '/tmp/IWD-MFP1') + + try: + self.stage_iwd(wd, '/tmp/IWD-MFP1') + except: + del wd + raise + + del wd def test_iwd_mfp2(self): - self.stage_iwd('/tmp/IWD-MFP2') + wd = IWD(True, '/tmp/IWD-MFP2') + + try: + self.stage_iwd(wd, '/tmp/IWD-MFP2') + except: + del wd + raise + + del wd if __name__ == '__main__': unittest.main(exit=True)