3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

autotests: Test filesystem watch in testKnownNetworks

This commit is contained in:
Andrew Zaborowski 2018-08-09 16:33:46 +02:00 committed by Denis Kenzior
parent 4b4875e6cf
commit 127c37ba66
3 changed files with 22 additions and 2 deletions

View File

@ -40,7 +40,9 @@ class Test(unittest.TestCase):
known_networks = wd.list_known_networks()
self.assertEqual(len(known_networks), 3)
known_networks[0].forget()
for network in known_networks:
if network.name == 'ssidTKIP':
network.forget()
known_networks = wd.list_known_networks()
self.assertEqual(len(known_networks), 2)
@ -50,6 +52,18 @@ class Test(unittest.TestCase):
known_networks = wd.list_known_networks()
self.assertEqual(len(known_networks), 3)
IWD.copy_to_storage('known_networks/ssidPSK.psk')
condition = 'len(obj.list_known_networks()) == 4'
wd.wait_for_object_condition(wd, condition, 1)
expected = ['ssidNew', 'ssidOpen', 'ssidPSK', 'ssidEAP-TLS']
self.assertEqual({n.name for n in wd.list_known_networks()},
set(expected))
IWD.remove_from_storage('ssidPSK.psk')
condition = 'len(obj.list_known_networks()) == 3'
wd.wait_for_object_condition(wd, condition, 1)
for net in known_networks:
net.forget()

View File

@ -0,0 +1,2 @@
[Security]
PreSharedKey=3397a05e2cf7b50a179ecc876422a40c84626d7eb3261d9baa080032b843f066

View File

@ -537,7 +537,7 @@ class KnownNetwork(IWDDBusAbstract):
@property
def name(self):
'''Contains the Name (SSID) of the network.'''
return self._properties['Name']
return str(self._properties['Name'])
@property
def type(self):
@ -857,6 +857,10 @@ class IWD(AsyncOpAbstract):
assert not os.path.isabs(source)
shutil.copy(source, IWD_STORAGE_DIR)
@staticmethod
def remove_from_storage(file_name):
os.system('rm -rf ' + IWD_STORAGE_DIR + '/\'' + file_name + '\'')
def list_devices(self, wait_to_appear = 0, max_wait = 15):
if not wait_to_appear:
return list(self._devices.values())