3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 05:39:24 +01:00

auto-t: Fixed AP test to work with multiple sub-tests

The single AP test worked fine, but adding a failure test caused some
problems. Since the kernel is never restarted between tests it maintains
old stale scan results from the previous test. This was causing an
assert to sometimes fail in the second test being run because it was
returning > 1 ordered networks. This change iterates through the ordered
network list and chooses the appropriate network rather than assuming
get_ordered_networks() will always return only one network object
This commit is contained in:
James Prestwood 2018-06-29 16:25:00 -07:00 committed by Denis Kenzior
parent 7fedc2bf66
commit 69fe274c7d
2 changed files with 16 additions and 4 deletions

View File

@ -25,8 +25,14 @@ class Test(unittest.TestCase):
wd.wait_for_object_condition(dev, condition)
ordered_networks = dev.get_ordered_networks()
self.assertEqual(len(ordered_networks), 1)
ordered_network = ordered_networks[0]
ordered_network = None
for network in ordered_networks:
if network.name == 'TestAP1':
ordered_network = network
break
self.assertNotEqual(ordered_network, None)
self.assertEqual(ordered_network.name, 'TestAP1')
self.assertEqual(ordered_network.type, NetworkType.psk)

View File

@ -25,8 +25,14 @@ class Test(unittest.TestCase):
wd.wait_for_object_condition(dev, condition)
ordered_networks = dev.get_ordered_networks()
self.assertEqual(len(ordered_networks), 1)
ordered_network = ordered_networks[0]
ordered_network = None
for network in ordered_networks:
if network.name == 'TestAP1':
ordered_network = network
break
self.assertNotEqual(ordered_network, None)
self.assertEqual(ordered_network.name, 'TestAP1')
self.assertEqual(ordered_network.type, NetworkType.psk)