From: Jenkins Date: Sat, 30 Aug 2014 12:43:21 +0000 (+0000) Subject: Merge "Fix IpNetnsCommand to execute without root_wrapper when no netns" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6844f45d574d5b100fcffddf0ee1f55afef864af;p=openstack-build%2Fneutron-build.git Merge "Fix IpNetnsCommand to execute without root_wrapper when no netns" --- 6844f45d574d5b100fcffddf0ee1f55afef864af diff --cc neutron/tests/unit/test_linux_ip_lib.py index 2aaa90b63,874dfbaee..3bd7f2617 --- a/neutron/tests/unit/test_linux_ip_lib.py +++ b/neutron/tests/unit/test_linux_ip_lib.py @@@ -822,11 -822,19 +822,20 @@@ 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) + def test_execute_nosudo_with_no_namespace(self): + with mock.patch('neutron.agent.linux.utils.execute') as execute: + self.parent.namespace = None + self.parent.root_helper = None + self.netns_cmd.execute(['test']) + execute.assert_called_once_with(['test'], + root_helper=None, + check_exit_code=True) + class TestDeviceExists(base.BaseTestCase): def test_device_exists(self):