2020-09-17 23:32:47 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import sys
|
2020-10-14 18:55:57 +02:00
|
|
|
import os
|
2021-02-25 23:00:50 +01:00
|
|
|
import shutil
|
2020-09-17 23:32:47 +02:00
|
|
|
|
|
|
|
sys.path.append('../util')
|
|
|
|
from iwd import IWD
|
|
|
|
from config import ctx
|
|
|
|
|
|
|
|
from ead import EAD
|
|
|
|
|
|
|
|
class Test(unittest.TestCase):
|
|
|
|
def test_connection_success(self):
|
2020-10-14 18:55:57 +02:00
|
|
|
env = os.environ.copy()
|
|
|
|
env['STATE_DIRECTORY'] = '/tmp/ead'
|
2021-02-25 23:00:50 +01:00
|
|
|
p = ctx.start_process(['ead', '-i', 'eth1', '-d'], env=env)
|
2020-09-17 23:32:47 +02:00
|
|
|
|
|
|
|
ead = EAD()
|
|
|
|
|
|
|
|
adapter = ead.list_adapters(1)[0]
|
|
|
|
|
|
|
|
condition = 'obj.connected == True'
|
2021-08-13 22:26:10 +02:00
|
|
|
IWD._wait_for_object_condition(adapter, condition)
|
2020-09-17 23:32:47 +02:00
|
|
|
|
|
|
|
condition = 'obj.authenticated == True'
|
2021-08-13 22:26:10 +02:00
|
|
|
IWD._wait_for_object_condition(adapter, condition)
|
2020-09-17 23:32:47 +02:00
|
|
|
|
2021-02-25 23:00:50 +01:00
|
|
|
ctx.stop_process(p)
|
2020-09-17 23:32:47 +02:00
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
2020-10-14 18:55:57 +02:00
|
|
|
os.mkdir('/tmp/ead')
|
|
|
|
|
|
|
|
IWD.copy_to_storage('default.8021x', storage_dir='/tmp/ead')
|
2020-09-17 23:32:47 +02:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
2020-10-14 18:55:57 +02:00
|
|
|
IWD.clear_storage(storage_dir='/tmp/ead')
|
2020-09-17 23:32:47 +02:00
|
|
|
|
2021-02-25 23:00:50 +01:00
|
|
|
shutil.rmtree('/tmp/ead')
|
|
|
|
|
2020-09-17 23:32:47 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(exit=True)
|