Fix test_time_hook functional test
The problematic code that causes "TypeError: string indices must be integers": -> self.assertEqual( expected, sorted(hook_results, key=lambda i: list( i["config"]["trigger"].values())[0]["unit"])) (Pdb) hook_results[0]["config"]["trigger"] {'name': 'event', 'args': {'unit': 'iteration', 'at': [5]}} values[0] is not always a dict with a unit element: (Pdb) hook_results[0]["config"]["trigger"].values() dict_values(['event', {'unit': 'iteration', 'at': [5]}]) We should use args['args']['unit'] instead. Change-Id: I42db6045ae88c34d3576beb737bb7e955c5f2132 Needed-By: I4991acccefd4754e209feafd5e24d03c76c283f8
This commit is contained in:
parent
32af8354f4
commit
6cef6a9a03
@ -1420,8 +1420,7 @@ class HookTestCase(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
expected,
|
||||
sorted(hook_results,
|
||||
key=lambda i: list(
|
||||
i["config"]["trigger"].values())[0]["unit"]))
|
||||
key=lambda i: i["config"]["trigger"]["args"]["unit"]))
|
||||
self._assert_results_time(hook_results)
|
||||
|
||||
def test_import_hook_result(self):
|
||||
|
Loading…
Reference in New Issue
Block a user