diff options
author | 2018-04-12 20:58:01 +0200 | |
---|---|---|
committer | 2018-04-12 21:05:55 +0200 | |
commit | 71c4b3b719289929c226cae60eb1b23ada16eeb2 (patch) | |
tree | fd90e6fcd06f2f12152ac9d3e9962162c215b09a /functest/tests/unit/openstack/tempest | |
parent | 51acd93bfe71e2cbd897f071e58b641ccd5ca1ac (diff) |
Fix role processing in Patrole
Role has to be listed in tempest.conf before calling testr.
It also saves the right config file.
Change-Id: Ifd122f31d0bfe3e9b3f93c6d62526acce96953d3
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/openstack/tempest')
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_conf_utils.py | 26 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_tempest.py | 16 |
2 files changed, 17 insertions, 25 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py index 161d9c076..8988e96a1 100644 --- a/functest/tests/unit/openstack/tempest/test_conf_utils.py +++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py @@ -188,28 +188,6 @@ class OSTempestConfUtilsTesting(unittest.TestCase): self.assertTrue(mock_get_vid.called) self.assertTrue(mock_get_did.called) - def test_backup_config_default(self): - with mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.path.exists', - return_value=False), \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.makedirs') as mock_makedirs, \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.shutil.copyfile') as mock_copyfile: - conf_utils.backup_tempest_config( - 'test_conf_file', res_dir='test_dir') - self.assertTrue(mock_makedirs.called) - self.assertTrue(mock_copyfile.called) - - with mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.path.exists', - return_value=True), \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.shutil.copyfile') as mock_copyfile: - conf_utils.backup_tempest_config( - 'test_conf_file', res_dir='test_dir') - self.assertTrue(mock_copyfile.called) - def _test_missing_param(self, params, image_id, flavor_id): with mock.patch('functest.opnfv_tests.openstack.tempest.' 'conf_utils.ConfigParser.RawConfigParser.' @@ -221,13 +199,11 @@ class OSTempestConfUtilsTesting(unittest.TestCase): 'conf_utils.ConfigParser.RawConfigParser.' 'write') as mwrite, \ 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', return_value={'validation': {'ssh_timeout': 300}}): os.environ['OS_ENDPOINT_TYPE'] = '' conf_utils.configure_tempest_update_params( - 'test_conf_file', res_dir='test_dir', image_id=image_id, + 'test_conf_file', image_id=image_id, flavor_id=flavor_id) mset.assert_any_call(params[0], params[1], params[2]) self.assertTrue(mread.called) diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index e2c4c975b..1fea4e41d 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -20,6 +20,7 @@ from functest.opnfv_tests.openstack.tempest import conf_utils class OSTempestTesting(unittest.TestCase): + # pylint: disable=too-many-public-methods def setUp(self): os_creds = OSCreds( @@ -101,6 +102,21 @@ class OSTempestTesting(unittest.TestCase): with self.assertRaises(Exception): self.tempestcommon.parse_verifier_result() + def test_backup_config_default(self): + with mock.patch('os.path.exists', return_value=False), \ + mock.patch('os.makedirs') as mock_makedirs, \ + mock.patch('shutil.copyfile') as mock_copyfile: + self.tempestcommon.backup_tempest_config( + 'test_conf_file', res_dir='test_dir') + self.assertTrue(mock_makedirs.called) + self.assertTrue(mock_copyfile.called) + + with mock.patch('os.path.exists', return_value=True), \ + mock.patch('shutil.copyfile') as mock_copyfile: + self.tempestcommon.backup_tempest_config( + 'test_conf_file', res_dir='test_dir') + self.assertTrue(mock_copyfile.called) + @mock.patch("os.rename") @mock.patch("os.remove") @mock.patch("os.path.exists", return_value=True) |