autotests: Always clean up in testAP

Make sure stop_ap is called on success and on failure in both tests so
that one can succeed after the other has failed.  Also make sure to move
both interfaces out of autoconnect state.
This commit is contained in:
Andrew Zaborowski 2018-08-24 03:37:49 +02:00 committed by Denis Kenzior
parent 700b7de175
commit 1024562e1d
2 changed files with 58 additions and 52 deletions

View File

@ -69,11 +69,14 @@ class Test(unittest.TestCase):
wd = IWD()
dev1, dev2 = wd.list_devices(2)
dev1.disconnect()
dev2.disconnect()
self.client_connect(wd, dev1)
dev1.start_ap('TestAP2', 'Password2')
try:
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
dev2.scan()
@ -95,7 +98,7 @@ class Test(unittest.TestCase):
networks['TestAP2'].network_object.connect()
wd.unregister_psk_agent(psk_agent)
finally:
dev1.stop_ap()
# Finally test dev1 can go to client mode and connect again

View File

@ -62,11 +62,14 @@ class Test(unittest.TestCase):
wd = IWD()
dev1, dev2 = wd.list_devices(2)
dev1.disconnect()
dev2.disconnect()
self.client_connect(wd, dev1)
dev1.start_ap('TestAP2', 'Password2')
try:
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
dev2.scan()
@ -107,7 +110,7 @@ class Test(unittest.TestCase):
condition = 'not obj.connected'
wd.wait_for_object_condition(networks['TestAP2'].network_object,
condition)
finally:
dev1.stop_ap()
# Finally test dev1 can go to client mode and connect again