]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensure assertion matches dict iter order in test
authorKevin Benton <blak111@gmail.com>
Tue, 5 Aug 2014 06:04:33 +0000 (00:04 -0600)
committerKevin Benton <blak111@gmail.com>
Wed, 6 Aug 2014 05:29:41 +0000 (22:29 -0700)
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

index 202ae933c5408802c920e0fae1af6315fa4ce866..959c3db3ffa071cb0d9b358b7727aa097ecbf03c 100644 (file)
@@ -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)