]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Run cfg.CONF.reset() on test cleanup
authorSteve Baker <sbaker@redhat.com>
Thu, 5 Sep 2013 23:35:38 +0000 (11:35 +1200)
committerSteve Baker <sbaker@redhat.com>
Thu, 5 Sep 2013 23:42:36 +0000 (11:42 +1200)
This means clear_override and clear_default do not
need to be called explicitly for each set_override and set_default
call.

This also fixes any potential test execution order issues
where an option has been set without being cleared at all.

Change-Id: Ic40c3be10b32eb3011bc0733cee9c1faaf8f1240
Fixes-Bug: #1221476

heat/tests/common.py
heat/tests/test_auth_password.py
heat/tests/test_heatclient.py

index 97df88a85eafba65ef506e47b8d00af238df19d1..f09fe8c0f308d86ff7d8caa71e022ad5b6e72cd4 100644 (file)
@@ -45,3 +45,4 @@ class HeatTestCase(testtools.TestCase):
                                'environment.d')
 
         cfg.CONF.set_default('environment_dir', env_dir)
+        self.addCleanup(cfg.CONF.reset)
index aba9b2b518b66ada96d54a7b03ae59d750d6cf99..75a99a36527e0e0abe4b6731c78a1cd890e1ea2f 100644 (file)
@@ -82,11 +82,6 @@ class KeystonePasswordAuthProtocolTest(HeatTestCase):
             expected_env={'HTTP_X_AUTH_URL': self.config['auth_uri']})
         self.middleware = KeystonePasswordAuthProtocol(self.app, self.config)
 
-    def tearDown(self):
-        super(KeystonePasswordAuthProtocolTest, self).tearDown()
-        cfg.CONF.clear_override('multi_cloud', 'auth_password')
-        cfg.CONF.clear_override('allowed_auth_uris', 'auth_password')
-
     def _start_fake_response(self, status, headers):
         self.response_status = int(status.split(' ', 1)[0])
         self.response_headers = dict(headers)
index e9399364bd65b905c6d410c559f37ca329b7c583..2605cbb111a37284f559c4926d77a56209e50295 100644 (file)
@@ -44,15 +44,6 @@ class KeystoneClientTest(HeatTestCase):
                               group='keystone_authtoken')
         self.addCleanup(self.m.VerifyAll)
 
-    def tearDown(self):
-        super(KeystoneClientTest, self).tearDown()
-        cfg.CONF.clear_override('deferred_auth_method')
-        cfg.CONF.clear_override('auth_uri', group='keystone_authtoken')
-        cfg.CONF.clear_override('admin_user', group='keystone_authtoken')
-        cfg.CONF.clear_override('admin_password', group='keystone_authtoken')
-        cfg.CONF.clear_override('admin_tenant_name',
-                                group='keystone_authtoken')
-
     def _stubs_v2(self, method='token', auth_ok=True):
         self.m.StubOutClassWithMocks(heat_keystoneclient.kc, "Client")
         if method == 'token':