3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

auto-t: MFP test

1) Switch to new Agent API
2) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
This commit is contained in:
Tim Kourt 2018-05-21 13:35:00 -07:00 committed by Denis Kenzior
parent ff5665beb8
commit d111e03035

View File

@ -59,14 +59,13 @@ class TestMFP(unittest.TestCase):
condition = 'not obj.connected' condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
def stage_iwd(self, config_dir): IWD.clear_storage()
wd = IWD(True, config_dir) def stage_iwd(self, wd, config_dir):
psk_agent = PSKAgent( ['secret123', 'secret123', 'secret123'] )
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent) wd.register_psk_agent(psk_agent)
devices = wd.list_devices(); devices = wd.list_devices(True);
self.assertIsNotNone(devices) self.assertIsNotNone(devices)
device = devices[0] device = devices[0]
@ -92,18 +91,38 @@ class TestMFP(unittest.TestCase):
wd.unregister_psk_agent(psk_agent) 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 del wd
IWD.clear_storage()
def test_iwd_mfp0(self):
self.stage_iwd('/tmp/IWD-MFP0')
def test_iwd_mfp1(self): 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): 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__': if __name__ == '__main__':
unittest.main(exit=True) unittest.main(exit=True)