Example #1
0
 def test_l2gw_callback_delete_port(self):
     service_plugin = mock.Mock()
     directory.add_plugin(constants.L2GW, service_plugin)
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context, 'port': fake_port}
     l2gateway_db.l2gw_callback(resources.PORT, events.AFTER_DELETE,
                                mock.Mock(), **fake_kwargs)
     self.assertTrue(service_plugin.delete_port_mac.called)
 def test_l2gw_callback_delete_port(self):
     service_plugin = mock.Mock()
     directory.add_plugin(constants.L2GW, service_plugin)
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context,
                    'port': fake_port}
     l2gateway_db.l2gw_callback(resources.PORT,
                                events.AFTER_DELETE,
                                mock.Mock(),
                                **fake_kwargs)
     self.assertTrue(service_plugin.delete_port_mac.called)
Example #3
0
 def test_l2gw_callback_delete_port(self):
     service_plugins = {constants.L2GW: mock.Mock()}
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context, 'port': fake_port}
     with mock.patch.object(manager.NeutronManager,
                            'get_service_plugins',
                            return_value=service_plugins):
         l2gateway_db.l2gw_callback(resources.PORT, events.AFTER_DELETE,
                                    mock.Mock(), **fake_kwargs)
         self.assertTrue(
             service_plugins[constants.L2GW].delete_port_mac.called)
Example #4
0
 def test_l2gw_callback_update_port(self, spawn_n):
     spawn_n.side_effect = lambda x, y, z: x(y, z)
     service_plugins = {constants.L2GW: mock.Mock()}
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context, 'port': fake_port}
     with mock.patch.object(manager.NeutronManager,
                            'get_service_plugins',
                            return_value=service_plugins):
         l2gateway_db.l2gw_callback(resources.PORT, events.AFTER_UPDATE,
                                    mock.Mock(), **fake_kwargs)
         self.assertTrue(
             service_plugins[constants.L2GW].add_port_mac.called)
 def test_l2gw_callback_delete_port(self):
     service_plugins = {constants.L2GW: mock.Mock()}
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context,
                    'port': fake_port}
     with mock.patch.object(manager.NeutronManager,
                            'get_service_plugins',
                            return_value=service_plugins):
         l2gateway_db.l2gw_callback(resources.PORT,
                                    events.AFTER_DELETE,
                                    mock.Mock(),
                                    **fake_kwargs)
         self.assertTrue(service_plugins[constants.L2GW].
                         delete_port_mac.called)
 def test_l2gw_callback_update_port(self, spawn_n):
     spawn_n.side_effect = lambda x, y, z: x(y, z)
     service_plugins = {constants.L2GW: mock.Mock()}
     fake_context = mock.Mock()
     fake_port = mock.Mock()
     fake_kwargs = {'context': fake_context,
                    'port': fake_port}
     with mock.patch.object(manager.NeutronManager,
                            'get_service_plugins',
                            return_value=service_plugins):
         l2gateway_db.l2gw_callback(resources.PORT,
                                    events.AFTER_UPDATE,
                                    mock.Mock(),
                                    **fake_kwargs)
         self.assertTrue(service_plugins[constants.L2GW].
                         add_port_mac.called)