eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

connection_test.py (1657B)


      1 #! /usr/bin/python3
      2 
      3 import unittest
      4 import sys
      5 
      6 sys.path.append('../util')
      7 import iwd
      8 from iwd import IWD, NetworkType, PSKAgent
      9 
     10 class Test(unittest.TestCase):
     11     def test_no_ap_mode(self):
     12         wd = IWD(True)
     13 
     14         dev = wd.list_devices(1)[0]
     15 
     16         with self.assertRaises(iwd.NotSupportedEx):
     17             dev.start_ap('TestAP2', 'Password2')
     18 
     19     def test_only_tkip_support(self):
     20         wd = IWD(True)
     21 
     22         devices = wd.list_devices(2)
     23 
     24         dev_sta = devices[0]
     25         dev_ap = devices[1]
     26 
     27         dev_ap.start_ap('TestAP2', 'Password2')
     28 
     29         self.assertTrue(dev_ap.group_cipher == 'TKIP')
     30         self.assertIn('TKIP', dev_ap.pairwise_ciphers)
     31 
     32         ordered_network = dev_sta.get_ordered_network('TestAP2')
     33 
     34         if ordered_network.type != NetworkType.psk:
     35             raise Exception("Network type mismatch")
     36 
     37         psk_agent = PSKAgent('Password2')
     38         wd.register_psk_agent(psk_agent)
     39 
     40         ordered_network.network_object.connect()
     41 
     42         condition = 'obj.state == DeviceState.connected'
     43         wd.wait_for_object_condition(dev_sta, condition)
     44 
     45         wd.unregister_psk_agent(psk_agent)
     46 
     47     def test_no_ccmp_support(self):
     48         wd = IWD(True)
     49 
     50         dev = wd.list_devices(2)[1]
     51 
     52         # Should fail to start since the radio doesn't support CCMP but the
     53         # profile only lists CCMP as allowed.
     54         with self.assertRaises(iwd.NotSupportedEx):
     55             dev.start_ap('TestAP2')
     56 
     57     @classmethod
     58     def setUpClass(cls):
     59         IWD.copy_to_ap('TestAP2.ap')
     60 
     61     @classmethod
     62     def tearDownClass(cls):
     63         IWD.clear_storage()
     64 
     65 if __name__ == '__main__':
     66     unittest.main(exit=True)