From 5ae2d9145be180ad2e8df7e887091a7fbad8fb08 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 5 Aug 2014 00:04:33 -0600 Subject: [PATCH] Ensure assertion matches dict iter order in test Fixes a test_linux_ip_lib test that made an assertion on a command that was called that could fail depending on the order of the dictionary when it was iterated over. This patch makes the assertion match the order that the command is constructed by iterating through the dictionary as well. Partial-Bug: #1348818 Change-Id: I7baa518169c193f7e98d38632e1db16eb57ffee7 --- neutron/tests/unit/test_linux_ip_lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/tests/unit/test_linux_ip_lib.py b/neutron/tests/unit/test_linux_ip_lib.py index 202ae933c54..959c3db3ffa 100644 --- a/neutron/tests/unit/test_linux_ip_lib.py +++ b/neutron/tests/unit/test_linux_ip_lib.py @@ -816,8 +816,9 @@ class TestIpNetnsCommand(TestIPCmdBase): env = dict(FOO=1, BAR=2) self.netns_cmd.execute(['ip', 'link', 'list'], env) execute.assert_called_once_with( - ['ip', 'netns', 'exec', 'ns', 'env', 'FOO=1', 'BAR=2', - 'ip', 'link', 'list'], + ['ip', 'netns', 'exec', 'ns', 'env'] + + ['%s=%s' % (k, v) for k, v in env.items()] + + ['ip', 'link', 'list'], root_helper='sudo', check_exit_code=True)