3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

auto-t: use copy_to_storage in address randomization test

This test was just piping the PSK files into /tmp/iwd/ssidCCMP.psk
which is a bit fragile if the storage dir was ever to change. Instead
use copy_to_storage and the 'name' keyword to copy the file.
This commit is contained in:
James Prestwood 2022-05-25 12:37:28 -07:00 committed by Denis Kenzior
parent 87bb9a42b5
commit e000eff492

View File

@ -46,7 +46,7 @@ class Test(unittest.TestCase):
perm_addr = device.address perm_addr = device.address
# 1. Test per-network deterministic MAC generation # 1. Test per-network deterministic MAC generation
os.system('cat pernetwork.psk > /tmp/iwd/ssidCCMP.psk') IWD.copy_to_storage('pernetwork.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd) new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr) self.assertNotEqual(perm_addr, new_addr)
# try again to ensure the generation was deterministic # try again to ensure the generation was deterministic
@ -54,7 +54,7 @@ class Test(unittest.TestCase):
self.assertEqual(new_addr, new_addr2) self.assertEqual(new_addr, new_addr2)
# 2. Test FullAddressRandomization # 2. Test FullAddressRandomization
os.system('cat full_random.psk > /tmp/iwd/ssidCCMP.psk') IWD.copy_to_storage('full_random.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd) new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr) self.assertNotEqual(perm_addr, new_addr)
# try again to make sure the generation was random # try again to make sure the generation was random
@ -62,7 +62,7 @@ class Test(unittest.TestCase):
self.assertNotEqual(new_addr, new_addr2) self.assertNotEqual(new_addr, new_addr2)
# 3. Test AddressOverride # 3. Test AddressOverride
os.system('cat override.psk > /tmp/iwd/ssidCCMP.psk') IWD.copy_to_storage('override.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd) new_addr = self.try_connection(wd)
self.assertEqual(new_addr, 'e6:f6:38:a9:02:02') self.assertEqual(new_addr, 'e6:f6:38:a9:02:02')