diff options
author | Stamatis Katsaounis <mokats@intracom-telecom.com> | 2019-01-24 15:46:09 +0200 |
---|---|---|
committer | Stamatis Katsaounis <mokats@intracom-telecom.com> | 2019-02-01 07:38:35 +0000 |
commit | 6b9e62527829867f52a8d18efb09d85b76b35436 (patch) | |
tree | 992ead76dc790a4812990ab4f77a5728293cfa3f /dovetail/tests/unit/test_test_runner.py | |
parent | b7ee5abe9b73cbc0928bf9ac080a6aecf05bcb7e (diff) |
Add ONAP VVP Heat Template validation tests
Change-Id: I9a3d56932ce41191901381831013768d1c57a749
Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to 'dovetail/tests/unit/test_test_runner.py')
-rw-r--r-- | dovetail/tests/unit/test_test_runner.py | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/dovetail/tests/unit/test_test_runner.py b/dovetail/tests/unit/test_test_runner.py index 4b5c00bb..0eb12135 100644 --- a/dovetail/tests/unit/test_test_runner.py +++ b/dovetail/tests/unit/test_test_runner.py @@ -323,7 +323,8 @@ class TestRunnerTesting(unittest.TestCase): @patch('dovetail.test_runner.os') def test_add_testcase_info(self, mock_os, mock_config): mock_os.getenv.side_effect = ['os_insecure', 'dovetail_home', 'debug', - 'os_cacert', 'host_url', 'csar_file'] + 'os_cacert', 'host_url', 'csar_file', + 'heat_templates_dir'] mock_os.environ = {'DEPLOY_SCENARIO': 'deploy_scenario'} mock_config.dovetail_config = {'build_tag': 'build_tag'} @@ -333,14 +334,17 @@ class TestRunnerTesting(unittest.TestCase): 'deploy_scenario': 'deploy_scenario', 'dovetail_home': 'dovetail_home', 'debug': 'debug', 'build_tag': 'build_tag', 'cacert': 'os_cacert', - 'host_url': 'host_url', 'csar_file': 'csar_file'} + 'host_url': 'host_url', 'csar_file': 'csar_file', + 'heat_templates_dir': 'heat_templates_dir' + } result = t_runner.FunctestRunner._add_testcase_info(self.testcase) self.testcase.validate_testcase.assert_called_once_with() self.testcase.name.assert_called_once_with() mock_os.getenv.assert_has_calls([ call('OS_INSECURE'), call('DOVETAIL_HOME'), call('DEBUG'), - call('OS_CACERT')]) + call('OS_CACERT'), call('HOST_URL'), call('CSAR_FILE'), + call('VNF_DIRECTORY')]) self.assertEquals(expected, result) @patch('dovetail.test_runner.dt_utils') @@ -672,3 +676,35 @@ class TestRunnerTesting(unittest.TestCase): mock_path.join.assert_has_calls([call('one', 'two')]) mock_path.isfile.assert_called_once() mock_utils.source_env.assert_called_once_with('env_file') + + @patch('dovetail.test_runner.dt_utils') + @patch('dovetail.test_runner.os.path') + @patch('dovetail.test_runner.dt_cfg') + def test_init_onapvvprunner_no_env_file(self, mock_config, mock_path, + mock_utils): + t_runner.OnapVvpRunner.create_log() + mock_path.join.side_effect = ['env_file'] + mock_config.dovetail_config = {'config_dir': 'one', 'env_file': 'two'} + mock_path.isfile.return_value = False + + docker_runner = t_runner.OnapVvpRunner(self.testcase) + + mock_path.join.assert_has_calls([call('one', 'two')]) + mock_path.isfile.assert_called_once() + docker_runner.logger.error.assert_called_once_with( + 'File env_file does not exist.') + + @patch('dovetail.test_runner.dt_utils') + @patch('dovetail.test_runner.os.path') + @patch('dovetail.test_runner.dt_cfg') + def test_init_onapvvprunner(self, mock_config, mock_path, mock_utils): + t_runner.OnapVvpRunner.create_log() + mock_path.join.side_effect = ['env_file'] + mock_config.dovetail_config = {'config_dir': 'one', 'env_file': 'two'} + mock_path.isfile.return_value = True + + t_runner.OnapVvpRunner(self.testcase) + + mock_path.join.assert_has_calls([call('one', 'two')]) + mock_path.isfile.assert_called_once() + mock_utils.source_env.assert_called_once_with('env_file') |