]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use renamed _fail_second_call() in cisco nexus tests
authorHenry Gessau <gessau@cisco.com>
Wed, 10 Sep 2014 03:50:09 +0000 (23:50 -0400)
committerHenry Gessau <gessau@cisco.com>
Wed, 10 Sep 2014 16:07:25 +0000 (12:07 -0400)
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

neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py

index 43d6b41adff15c0c51c9af82b01cd5f4e34e556c..17cab1a15bf155c40eb4b781c83f99059c39bbad 100644 (file)
@@ -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: