unittest: fix missing mock for list_nics

Change-Id: I0b31fb131bab4d87ad3a2695c584f13d2bee57f2
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commit is contained in:
Sahid Orentino Ferdjaoui 2019-05-14 17:12:25 +02:00
parent c0f53c5e26
commit 18e251b4b1

View File

@ -504,9 +504,11 @@ class TestNeutronOVSUtils(CharmTestCase):
self.assertTrue(expect[item] == _restart_map[item]) self.assertTrue(expect[item] == _restart_map[item])
self.assertEqual(len(_restart_map.keys()), 2) self.assertEqual(len(_restart_map.keys()), 2)
@patch('charmhelpers.contrib.openstack.context.list_nics',
return_value=['eth0'])
@patch.object(nutils, 'use_dvr') @patch.object(nutils, 'use_dvr')
@patch('charmhelpers.contrib.openstack.context.config') @patch('charmhelpers.contrib.openstack.context.config')
def test_configure_ovs_ovs_data_port(self, mock_config, _use_dvr): def test_configure_ovs_ovs_data_port(self, mock_config, _use_dvr, _nics):
_use_dvr.return_value = False _use_dvr.return_value = False
self.is_linuxbridge_interface.return_value = False self.is_linuxbridge_interface.return_value = False
mock_config.side_effect = self.test_config.get mock_config.side_effect = self.test_config.get
@ -537,9 +539,12 @@ class TestNeutronOVSUtils(CharmTestCase):
# Not called since we have a bogus bridge in data-ports # Not called since we have a bogus bridge in data-ports
self.assertFalse(self.add_bridge_port.called) self.assertFalse(self.add_bridge_port.called)
@patch('charmhelpers.contrib.openstack.context.list_nics',
return_value=['eth0', 'br-juju'])
@patch.object(nutils, 'use_dvr') @patch.object(nutils, 'use_dvr')
@patch('charmhelpers.contrib.openstack.context.config') @patch('charmhelpers.contrib.openstack.context.config')
def test_configure_ovs_data_port_with_bridge(self, mock_config, _use_dvr): def test_configure_ovs_data_port_with_bridge(
self, mock_config, _use_dvr, _nics):
_use_dvr.return_value = False _use_dvr.return_value = False
self.is_linuxbridge_interface.return_value = True self.is_linuxbridge_interface.return_value = True
mock_config.side_effect = self.test_config.get mock_config.side_effect = self.test_config.get