Isolate test from environment variables

One test ('test_get_client_all_creds') will fail if any of the typical
Openstack environment variables have been set (eg OS_PASSWORD).

Change-Id: I982f526168be7a5a07b5cd48af522f7f9bc74f2e
Closes-bug: #1376247
This commit is contained in:
Stuart McLaren 2014-10-01 12:53:53 +00:00
parent 2365a3fb5f
commit 60359e9b36
1 changed files with 7 additions and 1 deletions

View File

@ -78,13 +78,19 @@ class GetClientTestCase(utils.BaseTestCase):
def setUp(self):
super(GetClientTestCase, self).setUp()
self.host = 'test_host'
self.env = os.environ.copy()
os.environ.clear()
def tearDown(self):
os.environ = self.env
super(GetClientTestCase, self).tearDown()
def test_get_client_host_only(self):
expected_creds = {
'username': None,
'password': None,
'tenant': None,
'auth_url': os.getenv('OS_AUTH_URL'),
'auth_url': None,
'strategy': 'noauth',
'region': None
}