From: Kevin Benton Date: Tue, 5 Aug 2014 06:04:33 +0000 (-0600) Subject: Ensure assertion matches dict iter order in test X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5ae2d9145be180ad2e8df7e887091a7fbad8fb08;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/tests/unit/test_linux_ip_lib.py b/neutron/tests/unit/test_linux_ip_lib.py index 202ae933c..959c3db3f 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)