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
|
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'
|
|
|
|
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'
|
|
|
|
ead.wait_for_object_condition(adapter, condition)
|
|
|
|
|
|
|
|
condition = 'obj.authenticated == True'
|
|
|
|
ead.wait_for_object_condition(adapter, condition)
|
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(exit=True)
|