]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
BigSwitch: Stop HTTP patch before overriding
authorKevin Benton <blak111@gmail.com>
Tue, 8 Apr 2014 03:25:23 +0000 (20:25 -0700)
committerKevin Benton <blak111@gmail.com>
Tue, 8 Apr 2014 03:45:06 +0000 (20:45 -0700)
Stops the default HTTPConnection patch used by the
Big Switch tests before patching HTTPConnection with
another substitution. This prevents mock from losing
track of the default patch which was resulting in it
not consistently being stopped by the stopall call in
cleanup.

This also corrects an incorrectly targeted mock for the
HTTP patch in one of the test files.

Closes-Bug: #1303605
Change-Id: Ia5b374c5f8d3a7905d915de4f1f8d4f3a6f0e58d

neutron/tests/unit/bigswitch/test_capabilities.py
neutron/tests/unit/bigswitch/test_router_db.py

index 2b694210c4b9d67eceaab75a7488bfe42078f007..5dc1f29de97c59a5dc52c960e7a14b4bb9801096 100644 (file)
@@ -72,6 +72,8 @@ class CapabilitiesTests(test_router_db.RouterDBTestBase):
             # perform a task to cause capabilities to be retrieved
             with self.floatingip_with_assoc():
                 pass
+        # stop default HTTP patch since we need a magicmock
+        self.httpPatch.stop()
         # now mock HTTP class instead of REST so we can see headers
         conmock = mock.patch(HTTPCON).start()
         instance = conmock.return_value
index fa4ce284333fba0fcb4249ac9d27e7209bfbc6d9..e5b24262eceb385b4fb97199d701dbb8323007f8 100644 (file)
@@ -39,7 +39,7 @@ from neutron.tests.unit import test_extension_extradhcpopts as test_extradhcp
 from neutron.tests.unit import test_l3_plugin
 
 
-HTTPCON = 'neutron.plugins.bigswitch.servermanager.httplib.HTTPConnection'
+HTTPCON = 'neutron.plugins.bigswitch.servermanager.HTTPConnection'
 _uuid = uuidutils.generate_uuid
 
 
@@ -171,6 +171,7 @@ class RouterDBTestCase(RouterDBTestBase,
                         net_id=psub['subnet']['network_id'],
                         port_id=p1['port']['id'],
                         tenant_id=tenant1_id)
+                    self.httpPatch.stop()
                     multiFloatPatch = patch(
                         HTTPCON,
                         new=fake_server.VerifyMultiTenantFloatingIP)
@@ -180,6 +181,7 @@ class RouterDBTestCase(RouterDBTestBase,
                         port_id=p2['port']['id'],
                         tenant_id=tenant2_id)
                     multiFloatPatch.stop()
+                    self.httpPatch.start()
                     self._delete('floatingips', fl1['floatingip']['id'])
                     self._delete('floatingips', fl2['floatingip']['id'])
                     self._router_interface_action(