Browse Source

Add new list_nics mock

Change-Id: Ia3812ab0a141c795296ddcaf1815ef687c15094d
Closes-Bug: #1829465
changes/31/659731/1
Chris MacNaughton 2 months ago
parent
commit
75c1a037ad
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      unit_tests/test_neutron_utils.py

+ 6
- 2
unit_tests/test_neutron_utils.py View File

@@ -258,8 +258,10 @@ class TestNeutronUtils(CharmTestCase):
258 258
         ])
259 259
         self.add_bridge_port.assert_called_with('br-ex', 'eth0')
260 260
 
261
+    @patch('charmhelpers.contrib.openstack.context.list_nics',
262
+           return_value=['eth0', 'eth0.100', 'eth0.200'])
261 263
     @patch('charmhelpers.contrib.openstack.context.config')
262
-    def test_configure_ovs_ovs_data_port(self, mock_config):
264
+    def test_configure_ovs_ovs_data_port(self, mock_config, _nics):
263 265
         self.is_linuxbridge_interface.return_value = False
264 266
         mock_config.side_effect = self.test_config.get
265 267
         self.config.side_effect = self.test_config.get
@@ -306,8 +308,10 @@ class TestNeutronUtils(CharmTestCase):
306 308
                  call('br1', 'eth0.200', promisc=True)]
307 309
         self.add_bridge_port.assert_has_calls(calls, any_order=True)
308 310
 
311
+    @patch('charmhelpers.contrib.openstack.context.list_nics',
312
+           return_value=['br-eth0'])
309 313
     @patch('charmhelpers.contrib.openstack.context.config')
310
-    def test_configure_ovs_ovs_data_port_bridge(self, mock_config):
314
+    def test_configure_ovs_ovs_data_port_bridge(self, mock_config, _nics):
311 315
         self.is_linuxbridge_interface.return_value = True
312 316
         mock_config.side_effect = self.test_config.get
313 317
         self.config.side_effect = self.test_config.get

Loading…
Cancel
Save