3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-18 17:22:50 +01:00
iwd/autotests/testEAD/connection_test.py

45 lines
1012 B
Python
Raw Normal View History

2020-09-17 23:32:47 +02:00
#!/usr/bin/python3
import unittest
import sys
import os
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):
env = os.environ.copy()
env['STATE_DIRECTORY'] = '/tmp/ead'
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'
IWD._wait_for_object_condition(adapter, condition)
2020-09-17 23:32:47 +02:00
condition = 'obj.authenticated == True'
IWD._wait_for_object_condition(adapter, condition)
2020-09-17 23:32:47 +02:00
ctx.stop_process(p)
2020-09-17 23:32:47 +02:00
@classmethod
def setUpClass(cls):
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):
IWD.clear_storage(storage_dir='/tmp/ead')
2020-09-17 23:32:47 +02:00
shutil.rmtree('/tmp/ead')
2020-09-17 23:32:47 +02:00
if __name__ == '__main__':
unittest.main(exit=True)