Add basic unit test for config
Adding this exposed some python3 compatibility issues with iteritems. Change-Id: Ia78bd8edd17c7d2360ad958b3de734503d400774
This commit is contained in:
parent
7385528671
commit
076e9bd9be
@ -197,7 +197,7 @@ class OpenStackConfig(object):
|
||||
|
||||
os_args = dict()
|
||||
new_args = dict()
|
||||
for (key, val) in args.iteritems():
|
||||
for (key, val) in iter(args.items()):
|
||||
key = key.replace('-', '_')
|
||||
if key.startswith('os'):
|
||||
os_args[key[3:]] = val
|
||||
@ -285,7 +285,7 @@ class OpenStackConfig(object):
|
||||
config['auth'] = dict()
|
||||
|
||||
# Can't just do update, because None values take over
|
||||
for (key, val) in args.iteritems():
|
||||
for (key, val) in iter(args.items()):
|
||||
if val is not None:
|
||||
config[key] = val
|
||||
|
||||
|
24
os_client_config/tests/test_config.py
Normal file
24
os_client_config/tests/test_config.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import testtools
|
||||
|
||||
from os_client_config import cloud_config
|
||||
from os_client_config import config
|
||||
|
||||
|
||||
class TestConfig(testtools.TestCase):
|
||||
def test_get_one_cloud(self):
|
||||
c = config.OpenStackConfig()
|
||||
self.assertIsInstance(c.get_one_cloud(), cloud_config.CloudConfig)
|
Loading…
x
Reference in New Issue
Block a user