From eccf5e819ef918d566b7efd1e91719550d0fbef9 Mon Sep 17 00:00:00 2001 From: Henry Gessau Date: Tue, 9 Sep 2014 23:50:09 -0400 Subject: [PATCH] Use renamed _fail_second_call() in cisco nexus tests In commit 5e4b0c6fc6670ea036d801ce53444272bc311929 NeutronDbPluginV2TestCase _do_side_effect() was renamed to _fail_second_call(), but the nexus test cases were not updated. The tests still worked because they check for HTTPInternalServerError which is the end result of the server encountering "AttributeError: object has no attribute '_do_side_effect'". So the fault injection still worked, but not in the way intended. Note: the monolithic nexus plugin is not updated here since it is being removed from the tree. Closes-bug: #1367552 Change-Id: I083285fff5144d8dc35bd5b64faa7e400c68bcff --- .../drivers/cisco/nexus/test_cisco_mech.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py index 43d6b41ad..17cab1a15 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py +++ b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py @@ -303,8 +303,8 @@ class TestCiscoPortsV2(CiscoML2MechanismTestCase, 'create_port') as patched_plugin: def side_effect(*args, **kwargs): - return self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + return self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect with self.network() as net: @@ -337,8 +337,8 @@ class TestCiscoPortsV2(CiscoML2MechanismTestCase, 'create_port') as patched_plugin: def side_effect(*args, **kwargs): - return self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + return self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect res = self._create_port_bulk(self.fmt, 2, net['network']['id'], @@ -677,8 +677,8 @@ class TestCiscoNetworksV2(CiscoML2MechanismTestCase, with mock.patch.object(plugin_obj, 'create_network') as patched_plugin: def side_effect(*args, **kwargs): - return self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + return self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect res = self._create_network_bulk(self.fmt, 2, 'test', True) LOG.debug("response is %s" % res) @@ -697,8 +697,8 @@ class TestCiscoNetworksV2(CiscoML2MechanismTestCase, 'create_network') as patched_plugin: def side_effect(*args, **kwargs): - return self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + return self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect res = self._create_network_bulk(self.fmt, 2, 'test', True) @@ -729,8 +729,8 @@ class TestCiscoSubnetsV2(CiscoML2MechanismTestCase, 'create_subnet') as patched_plugin: def side_effect(*args, **kwargs): - self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect with self.network() as net: @@ -751,8 +751,8 @@ class TestCiscoSubnetsV2(CiscoML2MechanismTestCase, with mock.patch.object(plugin_obj, 'create_subnet') as patched_plugin: def side_effect(*args, **kwargs): - return self._do_side_effect(patched_plugin, orig, - *args, **kwargs) + return self._fail_second_call(patched_plugin, orig, + *args, **kwargs) patched_plugin.side_effect = side_effect with self.network() as net: -- 2.45.2