From 13067de652d6ccdcfc85f0f5e65841b644d9a6e9 Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Thu, 10 Aug 2017 12:06:05 +0000 Subject: Fix the logic of adding/updating tempest.conf Change-Id: I850311a9306607106836f24594019e98d2fd9499 Signed-off-by: Linda Wang --- functest/opnfv_tests/openstack/tempest/conf_utils.py | 2 +- functest/tests/unit/openstack/tempest/test_conf_utils.py | 5 ++--- 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, -- cgit 1.2.3-korg