Merge "Change OVS tunnel tests to support unittest.mock"

changes/16/714716/1
Zuul 3 years ago committed by Gerrit Code Review
commit 56c7db5e7f
  1. 14
      neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py

@ -20,7 +20,6 @@ import mock
from neutron_lib import constants as n_const
from oslo_config import cfg
from oslo_log import log
import six
from neutron.agent.common import ip_lib
from neutron.agent.common import ovs_lib
@ -31,13 +30,6 @@ from neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent \
import test_vlanmanager
def nonzero(f):
if six.PY3:
return f.__bool__()
else:
return f.__nonzero__()
# Useful global dummy variables.
NET_UUID = '3faeebfe-5d37-11e1-a64b-000c29d5f0a7'
LS_ID = 420
@ -257,7 +249,7 @@ class TunnelTest(object):
mock.call.create(secure_mode=True),
mock.call.setup_controllers(mock.ANY),
mock.call.port_exists('patch-int'),
nonzero(mock.call.port_exists()),
mock.ANY,
mock.call.add_patch_port('patch-int', 'patch-tun'),
]
self.mock_int_bridge_expected += [
@ -713,7 +705,7 @@ class TunnelTestUseVethInterco(TunnelTest):
mock.call.create(secure_mode=True),
mock.call.setup_controllers(mock.ANY),
mock.call.port_exists('patch-int'),
nonzero(mock.call.port_exists()),
mock.ANY,
mock.call.add_patch_port('patch-int', 'patch-tun'),
]
self.mock_int_bridge_expected += [
@ -733,7 +725,7 @@ class TunnelTestUseVethInterco(TunnelTest):
self.ipdevice_expected = [
mock.call('int-%s' % self.MAP_TUN_BRIDGE),
mock.call().exists(),
nonzero(mock.call().exists()),
mock.ANY,
mock.call().link.delete()
]
self.ipwrapper_expected = [

Loading…
Cancel
Save