From 8ba5f9d72d9ab8618c57548d202ea81c8b5f8a19 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 28 Nov 2012 12:16:26 +0000 Subject: Use flags() helper method to override config in tests Setting config option values using setattr() is dangerous because the value remains set even after the particular test finishes, so you can end up with other tests relying on it and being unable to run tests in isolation. We have a helper method for doing this, just use it. Change-Id: I872d7a4f70eceb9ff64f56901cb45552f237c733 --- nova/tests/integrated/test_api_samples.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index e86c334b1..d82dd3154 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -613,7 +613,7 @@ class ServersActionsJsonTest(ServersSampleBase): 'server-action-rebuild-resp') def test_server_resize(self): - CONF.allow_resize_to_same_host = True + self.flags(allow_resize_to_same_host=True) uuid = self._post_server() self._test_server_action(uuid, "resize", {"id": 2, @@ -1157,7 +1157,7 @@ class CloudPipeSampleJsonTest(ApiSampleTestBase): def test_cloud_pipe_create(self): """Get api samples of cloud pipe extension creation""" - CONF.vpn_image_id = fake.get_valid_image_id() + self.flags(vpn_image_id=fake.get_valid_image_id()) project = {'project_id': 'cloudpipe-' + str(uuid.uuid4())} response = self._do_post('os-cloudpipe', 'cloud-pipe-create-req', project) -- cgit