aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-10 12:06:05 +0000
committerLinda Wang <wangwulin@huawei.com>2017-08-10 12:07:26 +0000
commit13067de652d6ccdcfc85f0f5e65841b644d9a6e9 (patch)
tree0ad1f87eb56b926b833c89a32f385e28bb62b4ff
parent42877bb48714293d3ec761f42007fcc8fa925724 (diff)
Fix the logic of adding/updating tempest.conf
Change-Id: I850311a9306607106836f24594019e98d2fd9499 Signed-off-by: Linda Wang <wangwulin@huawei.com>
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py2
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py5
2 files changed, 3 insertions, 4 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 2313ec04b..7c88fc5d3 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -336,7 +336,7 @@ def configure_tempest_update_params(tempest_conf_file,
'into tempest.conf file')
with open(TEMPEST_CONF_YAML) as f:
conf_yaml = yaml.safe_load(f)
- if not conf_yaml:
+ if conf_yaml:
sections = config.sections()
for section in conf_yaml:
if section not in sections:
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 79ef99150..a807ae469 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -262,10 +262,9 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
mock.patch('__builtin__.open', mock.mock_open()), \
mock.patch('functest.opnfv_tests.openstack.tempest.'
'conf_utils.backup_tempest_config'), \
- mock.patch('functest.utils.functest_utils.yaml.safe_load') \
- as mock_yaml:
+ mock.patch('functest.utils.functest_utils.yaml.safe_load',
+ return_value={'validation': {'ssh_timeout': 300}}):
CONST.__setattr__('OS_ENDPOINT_TYPE', None)
- mock_yaml.return_value = mock.Mock()
conf_utils.\
configure_tempest_update_params('test_conf_file',
IMAGE_ID=image_id,