update param in loggerd unit test

This commit is contained in:
Adeeb Shihadeh 2024-01-17 15:08:36 -08:00
parent 7ce29ef08e
commit 5f1e7649e3
1 changed files with 4 additions and 4 deletions

View File

@ -116,7 +116,7 @@ class TestLoggerd(unittest.TestCase):
params.clear_all() params.clear_all()
for k, _, v in fake_params: for k, _, v in fake_params:
params.put(k, v) params.put(k, v)
params.put("LaikadEphemerisV3", "abc") params.put("AccessToken", "abc")
lr = list(LogReader(str(self._gen_bootlog()))) lr = list(LogReader(str(self._gen_bootlog())))
initData = lr[0].initData initData = lr[0].initData
@ -133,14 +133,14 @@ class TestLoggerd(unittest.TestCase):
# check params # check params
logged_params = {entry.key: entry.value for entry in initData.params.entries} logged_params = {entry.key: entry.value for entry in initData.params.entries}
expected_params = {k for k, _, __ in fake_params} | {'LaikadEphemerisV3'} expected_params = {k for k, _, __ in fake_params} | {'AccessToken'}
assert set(logged_params.keys()) == expected_params, set(logged_params.keys()) ^ expected_params assert set(logged_params.keys()) == expected_params, set(logged_params.keys()) ^ expected_params
assert logged_params['LaikadEphemerisV3'] == b'', f"DONT_LOG param value was logged: {repr(logged_params['LaikadEphemerisV3'])}" assert logged_params['AccessToken'] == b'', f"DONT_LOG param value was logged: {repr(logged_params['AccessToken'])}"
for param_key, initData_key, v in fake_params: for param_key, initData_key, v in fake_params:
self.assertEqual(getattr(initData, initData_key), v) self.assertEqual(getattr(initData, initData_key), v)
self.assertEqual(logged_params[param_key].decode(), v) self.assertEqual(logged_params[param_key].decode(), v)
params.put("LaikadEphemerisV3", "") params.put("AccessToken", "")
def test_rotation(self): def test_rotation(self):
os.environ["LOGGERD_TEST"] = "1" os.environ["LOGGERD_TEST"] = "1"