failure_test.py (1070B)
1 #!/usr/bin/python3 2 3 import unittest 4 import sys 5 import time 6 from time import sleep 7 8 sys.path.append('../util') 9 import iwd 10 from iwd import IWD 11 import testutil 12 13 class Test(unittest.TestCase): 14 15 def validate_connection(self, wd): 16 dev1, dev2 = wd.list_devices(2) 17 18 self.assertIsNotNone(dev1) 19 self.assertIsNotNone(dev2) 20 21 dev1.start_adhoc("AdHocNetwork", "secret123") 22 sleep(1) 23 dev2.start_adhoc("AdHocNetwork", "InvalidPassword") 24 #TODO: This test is unfinished. 25 26 # dev1.adhoc_wait_for_connected(dev2.address) 27 # dev2.adhoc_wait_for_connected(dev1.address) 28 29 # testutil.test_iface_operstate(dev1.name) 30 # testutil.test_iface_operstate(dev2.name) 31 # testutil.test_ifaces_connected(dev1.name, dev2.name) 32 33 def test_connection_failure(self): 34 wd = IWD(True) 35 36 self.validate_connection(wd) 37 38 @classmethod 39 def setUpClass(cls): 40 pass 41 42 @classmethod 43 def tearDownClass(cls): 44 IWD.clear_storage() 45 46 if __name__ == '__main__': 47 unittest.main(exit=True)