auto-t: EAP-PWD

1) Removed duplicated entries form .conf
2) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
3) Switched to list_devices with wait option
This commit is contained in:
Tim Kourt 2018-05-21 13:35:01 -07:00 committed by Denis Kenzior
parent d111e03035
commit 68bc64c8cd
3 changed files with 29 additions and 22 deletions

View File

@ -11,14 +11,12 @@ from iwd import NetworkType
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True)
wd.wait(1)
psk_agent = PSKAgent('eap-pwd-identity', ('eap-pwd-identity', 'secret123'))
def validate_connection(self, wd):
psk_agent = PSKAgent('eap-pwd-identity', ('eap-pwd-identity',
'secret123'))
wd.register_psk_agent(psk_agent)
devices = wd.list_devices();
devices = wd.list_devices(True);
self.assertIsNotNone(devices)
device = devices[0]
@ -44,10 +42,7 @@ class Test(unittest.TestCase):
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
try:
ordered_network.network_object.connect()
except:
raise
ordered_network.network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@ -59,6 +54,15 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
def test_connection_success(self):
wd = IWD(True)
try:
self.validate_connection(wd)
except:
del wd
raise
del wd
@classmethod

View File

@ -10,11 +10,8 @@ from iwd import NetworkType
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True, '/tmp/IWD-Frag')
wd.wait(1)
devices = wd.list_devices();
def validate_connection(self, wd):
devices = wd.list_devices(True);
self.assertIsNotNone(devices)
device = devices[0]
@ -30,20 +27,17 @@ class Test(unittest.TestCase):
ordered_network = None
for o_n in ordered_networks:
if o_n.name == "ssidEAP-PWD-frag":
if o_n.name == 'ssidEAP-PWD-frag':
ordered_network = o_n
break
self.assertEqual(ordered_network.name, "ssidEAP-PWD-frag")
self.assertEqual(ordered_network.name, 'ssidEAP-PWD-frag')
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
try:
ordered_network.network_object.connect()
except:
raise
ordered_network.network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@ -53,6 +47,15 @@ class Test(unittest.TestCase):
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_connection_success(self):
wd = IWD(True)
try:
self.validate_connection(wd)
except:
del wd
raise
del wd
@classmethod

View File

@ -11,5 +11,5 @@ wpa_key_mgmt=WPA-EAP
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP TKIP
wpa_passphrase=secret123
channel=1
pwd_group=19