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:
parent
d111e03035
commit
68bc64c8cd
|
@ -11,14 +11,12 @@ from iwd import NetworkType
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def validate_connection(self, wd):
|
||||||
wd = IWD(True)
|
psk_agent = PSKAgent('eap-pwd-identity', ('eap-pwd-identity',
|
||||||
wd.wait(1)
|
'secret123'))
|
||||||
|
|
||||||
psk_agent = PSKAgent('eap-pwd-identity', ('eap-pwd-identity', '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]
|
||||||
|
|
||||||
|
@ -44,10 +42,7 @@ class Test(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)
|
||||||
|
|
||||||
try:
|
ordered_network.network_object.connect()
|
||||||
ordered_network.network_object.connect()
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
|
|
||||||
condition = 'obj.connected'
|
condition = 'obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
@ -59,6 +54,15 @@ class Test(unittest.TestCase):
|
||||||
|
|
||||||
wd.unregister_psk_agent(psk_agent)
|
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
|
del wd
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -10,11 +10,8 @@ from iwd import NetworkType
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def validate_connection(self, wd):
|
||||||
wd = IWD(True, '/tmp/IWD-Frag')
|
devices = wd.list_devices(True);
|
||||||
wd.wait(1)
|
|
||||||
|
|
||||||
devices = wd.list_devices();
|
|
||||||
self.assertIsNotNone(devices)
|
self.assertIsNotNone(devices)
|
||||||
device = devices[0]
|
device = devices[0]
|
||||||
|
|
||||||
|
@ -30,20 +27,17 @@ class Test(unittest.TestCase):
|
||||||
ordered_network = None
|
ordered_network = None
|
||||||
|
|
||||||
for o_n in ordered_networks:
|
for o_n in ordered_networks:
|
||||||
if o_n.name == "ssidEAP-PWD-frag":
|
if o_n.name == 'ssidEAP-PWD-frag':
|
||||||
ordered_network = o_n
|
ordered_network = o_n
|
||||||
break
|
break
|
||||||
|
|
||||||
self.assertEqual(ordered_network.name, "ssidEAP-PWD-frag")
|
self.assertEqual(ordered_network.name, 'ssidEAP-PWD-frag')
|
||||||
self.assertEqual(ordered_network.type, NetworkType.eap)
|
self.assertEqual(ordered_network.type, NetworkType.eap)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
try:
|
ordered_network.network_object.connect()
|
||||||
ordered_network.network_object.connect()
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
|
|
||||||
condition = 'obj.connected'
|
condition = 'obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
@ -53,6 +47,15 @@ class Test(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 test_connection_success(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.validate_connection(wd)
|
||||||
|
except:
|
||||||
|
del wd
|
||||||
|
raise
|
||||||
|
|
||||||
del wd
|
del wd
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -11,5 +11,5 @@ wpa_key_mgmt=WPA-EAP
|
||||||
wpa_pairwise=TKIP CCMP
|
wpa_pairwise=TKIP CCMP
|
||||||
rsn_pairwise=CCMP TKIP
|
rsn_pairwise=CCMP TKIP
|
||||||
wpa_passphrase=secret123
|
wpa_passphrase=secret123
|
||||||
channel=1
|
|
||||||
pwd_group=19
|
pwd_group=19
|
||||||
|
|
Loading…
Reference in New Issue