diff options
-rw-r--r-- | docs/testing/user/userguide/vnf_test_guide.rst | 4 | ||||
-rw-r--r-- | dovetail/tests/unit/cli/test_cli_base.py | 8 | ||||
-rw-r--r-- | dovetail/tests/unit/test_container.py | 44 | ||||
-rw-r--r-- | dovetail/tests/unit/test_report.py | 128 | ||||
-rw-r--r-- | dovetail/tests/unit/test_run.py | 62 | ||||
-rw-r--r-- | dovetail/tests/unit/test_test_runner.py | 26 | ||||
-rw-r--r-- | dovetail/tests/unit/test_testcase.py | 141 | ||||
-rw-r--r-- | dovetail/tests/unit/utils/test_dovetail_config.py | 2 | ||||
-rw-r--r-- | dovetail/tests/unit/utils/test_dovetail_logger.py | 8 |
9 files changed, 211 insertions, 212 deletions
diff --git a/docs/testing/user/userguide/vnf_test_guide.rst b/docs/testing/user/userguide/vnf_test_guide.rst index e35d418f..cce94088 100644 --- a/docs/testing/user/userguide/vnf_test_guide.rst +++ b/docs/testing/user/userguide/vnf_test_guide.rst @@ -12,8 +12,8 @@ Overview As the LFN verification framework, Dovetail covers ONAP VNF tests by integrating VNF SDK and VVP. This guide introduces only how to use Dovetail to run the tests. For more details about VNF SDK and VVP, please refer to `ONAP VNF SDK Compliance Verification Program -<https://docs.onap.org/en/latest/submodules/vnfsdk/model.git/docs/files/VNFSDK-LFN-CVC.html>`_ -and `ONAP VVP <https://docs.onap.org/en/latest/submodules/vvp/documentation.git/docs/index.html>`_. +<https://docs.onap.org/en/dublin/submodules/vnfsdk/model.git/docs/files/VNFSDK-LFN-CVC.html>`_ +and `ONAP VVP <https://docs.onap.org/en/dublin/submodules/vvp/documentation.git/docs/index.html>`_. Definitions and abbreviations diff --git a/dovetail/tests/unit/cli/test_cli_base.py b/dovetail/tests/unit/cli/test_cli_base.py index 80b7e7b3..9b06426c 100644 --- a/dovetail/tests/unit/cli/test_cli_base.py +++ b/dovetail/tests/unit/cli/test_cli_base.py @@ -24,7 +24,7 @@ class CliBaseTesting(unittest.TestCase): runner = CliRunner() result = runner.invoke(cli_base.cli, []) - self.assertEquals(result.exit_code, 0) + self.assertEqual(result.exit_code, 0) def test_testcase_list(self, mock_testcase): testsuite = 'suite' @@ -33,7 +33,7 @@ class CliBaseTesting(unittest.TestCase): result = runner.invoke(cli_base.testcase_list, [testsuite]) mock_testcase.list_testsuites.assert_called_once_with(testsuite) - self.assertEquals(result.exit_code, 0) + self.assertEqual(result.exit_code, 0) def test_testcase_show(self, mock_testcase): testcase = 'case' @@ -42,7 +42,7 @@ class CliBaseTesting(unittest.TestCase): result = runner.invoke(cli_base.testcase_show, [testcase]) mock_testcase.show_testcase.assert_called_once_with(testcase) - self.assertEquals(result.exit_code, 0) + self.assertEqual(result.exit_code, 0) def test_testcase_run(self, mock_testcase): run_args = ('arga', 'argb') @@ -52,4 +52,4 @@ class CliBaseTesting(unittest.TestCase): expected = ' '.join(run_args) mock_testcase.run.assert_called_once_with(expected) - self.assertEquals(result.exit_code, 0) + self.assertEqual(result.exit_code, 0) diff --git a/dovetail/tests/unit/test_container.py b/dovetail/tests/unit/test_container.py index 7c758a7c..01c1d8fd 100644 --- a/dovetail/tests/unit/test_container.py +++ b/dovetail/tests/unit/test_container.py @@ -192,7 +192,7 @@ class ContainerTesting(unittest.TestCase): result = self.container.get_container(container_name) - self.assertEquals(expected, result) + self.assertEqual(expected, result) def test_get_container_none(self): container_name = 'container' @@ -201,11 +201,11 @@ class ContainerTesting(unittest.TestCase): result = self.container.get_container(container_name) - self.assertEquals(None, result) + self.assertEqual(None, result) def test_pull_image_none(self): result = self.container.pull_image(None) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch.object(Container, 'pull_image_only') @patch.object(Container, 'get_image_id') @@ -217,7 +217,7 @@ class ContainerTesting(unittest.TestCase): mock_get.assert_called_once_with(docker_image) mock_pull.assert_called_once_with(docker_image) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch.object(Container, 'pull_image_only') @patch.object(Container, 'get_image_id') @@ -233,7 +233,7 @@ class ContainerTesting(unittest.TestCase): call(docker_image), call(docker_image)]) self.logger.error.assert_called_once_with( 'Failed to get the id of image {}.'.format(docker_image)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch.object(Container, 'pull_image_only') @patch.object(Container, 'get_image_id') @@ -247,7 +247,7 @@ class ContainerTesting(unittest.TestCase): mock_pull.assert_called_once_with(docker_image) mock_get.assert_has_calls([ call(docker_image), call(docker_image)]) - self.assertEquals(docker_image, result) + self.assertEqual(docker_image, result) @patch.object(Container, 'pull_image_only') @patch.object(Container, 'get_image_id') @@ -263,7 +263,7 @@ class ContainerTesting(unittest.TestCase): call(docker_image), call(docker_image)]) self.logger.debug.assert_called_once_with( 'Image {} has no changes, no need to remove.'.format(docker_image)) - self.assertEquals(docker_image, result) + self.assertEqual(docker_image, result) @patch.object(Container, 'remove_image') @patch.object(Container, 'pull_image_only') @@ -280,7 +280,7 @@ class ContainerTesting(unittest.TestCase): mock_get.assert_has_calls([ call(docker_image), call(docker_image)]) mock_remove.assert_called_once_with(old_obj) - self.assertEquals(docker_image, result) + self.assertEqual(docker_image, result) def test_pull_image_only(self): docker_image = 'image' @@ -289,7 +289,7 @@ class ContainerTesting(unittest.TestCase): self.logger.debug.assert_called_once_with( 'Success to pull docker image {}!'.format(docker_image)) - self.assertEquals(True, result) + self.assertEqual(True, result) def test_pull_image_only_error(self): docker_image = 'image' @@ -299,7 +299,7 @@ class ContainerTesting(unittest.TestCase): self.logger.error.assert_called_once_with( 'Failed to pull docker image {}!'.format(docker_image)) - self.assertEquals(False, result) + self.assertEqual(False, result) def test_remove_image(self): image_id = 'image_id' @@ -311,7 +311,7 @@ class ContainerTesting(unittest.TestCase): self.logger.debug.assert_has_calls([ call('Remove image {}.'.format(image_id)), call('Remove image {} successfully.'.format(image_id))]) - self.assertEquals(True, result) + self.assertEqual(True, result) def test_remove_image_ancestors(self): image_id = 'image_id' @@ -321,7 +321,7 @@ class ContainerTesting(unittest.TestCase): self.logger.debug.assert_called_once_with( 'Image {} has containers, skip.'.format(image_id)) - self.assertEquals(True, result) + self.assertEqual(True, result) def test_remove_image_error(self): image_id = 'image_id' @@ -335,7 +335,7 @@ class ContainerTesting(unittest.TestCase): 'Remove image {}.'.format(image_id)) self.logger.error.assert_called_once_with( 'Failed to remove image {}.'.format(image_id)) - self.assertEquals(False, result) + self.assertEqual(False, result) def test_get_image_id(self): image_name = 'image_id' @@ -345,7 +345,7 @@ class ContainerTesting(unittest.TestCase): result = self.container.get_image_id(image_name) - self.assertEquals(image_name, result) + self.assertEqual(image_name, result) def test_get_image_id_error(self): image_name = 'image_id' @@ -354,7 +354,7 @@ class ContainerTesting(unittest.TestCase): result = self.container.get_image_id(image_name) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.container.dt_utils') def test_get_config(self, mock_utils): @@ -364,7 +364,7 @@ class ContainerTesting(unittest.TestCase): result = self.container._get_config('a', 'b', 'c') mock_utils.get_value_from_dict.assert_called_once_with('a', 'c') - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.container.dt_utils') def test_get_config_none(self, mock_utils): @@ -376,7 +376,7 @@ class ContainerTesting(unittest.TestCase): call('a', 'c'), call('a', 'b')]) self.logger.error.assert_called_once_with( "Couldn't find key {}.".format('a')) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.container.dt_cfg') @patch.object(Container, '_get_config') @@ -390,7 +390,7 @@ class ContainerTesting(unittest.TestCase): mock_get_conf.assert_has_calls([ call('image_name', 'value', {'type': 'bottlenecks'}), call('docker_tag', 'value', {'type': 'bottlenecks'})]) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.container.dt_logger') def test_create_log(self, mock_logger): @@ -400,7 +400,7 @@ class ContainerTesting(unittest.TestCase): self.container.create_log() - self.assertEquals(self.logger, self.container.logger) + self.assertEqual(self.logger, self.container.logger) @patch('dovetail.container.dt_utils') @patch('dovetail.container.dt_cfg') @@ -425,7 +425,7 @@ class ContainerTesting(unittest.TestCase): call('envs', project_config), call('volumes', project_config)]) mock_utils.get_hosts_info.assert_called_once_with(self.logger) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.container.dt_utils') @patch('dovetail.container.dt_cfg') @@ -440,7 +440,7 @@ class ContainerTesting(unittest.TestCase): mock_utils.get_value_from_dict.assert_has_calls([ call('opts', 'value'), call('shell', 'value')]) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.container.dt_utils') @patch('dovetail.container.dt_cfg') @@ -462,4 +462,4 @@ class ContainerTesting(unittest.TestCase): call('envs', project_config), call('volumes', project_config)]) mock_utils.get_hosts_info.assert_called_once_with(self.logger) - self.assertEquals(None, result) + self.assertEqual(None, result) diff --git a/dovetail/tests/unit/test_report.py b/dovetail/tests/unit/test_report.py index f7f8adc8..f89d0e40 100644 --- a/dovetail/tests/unit/test_report.py +++ b/dovetail/tests/unit/test_report.py @@ -66,7 +66,7 @@ class ReportTesting(unittest.TestCase): dt_report.Report.create_log() - self.assertEquals(getlogger_obj, dt_report.Report.logger) + self.assertEqual(getlogger_obj, dt_report.Report.logger) @patch('dovetail.report.os.path') @patch('dovetail.report.dt_cfg') @@ -98,7 +98,7 @@ class ReportTesting(unittest.TestCase): 'Results have been stored with files: [\'results_file\'].') mock_get.assert_called_once_with(testcase_obj, ['results_file']) mock_check.assert_called_once_with(testcase_obj, 'result') - self.assertEquals('result', result) + self.assertEqual('result', result) @patch('dovetail.report.os.path') @patch('dovetail.report.dt_cfg') @@ -128,7 +128,7 @@ class ReportTesting(unittest.TestCase): logger_obj.error.assert_called_once_with( 'Failed to store results with file results_file.') mock_check.assert_called_once_with(testcase_obj) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.os.path') @patch('dovetail.report.dt_cfg') @@ -155,7 +155,7 @@ class ReportTesting(unittest.TestCase): "Failed to get 'check_results_files' from config " "file of test case name") mock_check.assert_called_once_with(testcase_obj) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.CheckerFactory') def test_check_result(self, mock_factory): @@ -233,7 +233,7 @@ class ReportTesting(unittest.TestCase): ] } - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.os.getenv') @patch('dovetail.report.Testcase') @@ -294,7 +294,7 @@ class ReportTesting(unittest.TestCase): ] } - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.os.getenv') @patch('dovetail.report.Testcase') @@ -355,7 +355,7 @@ class ReportTesting(unittest.TestCase): ] } - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.datetime.datetime') @patch('dovetail.report.dt_cfg') @@ -387,7 +387,7 @@ class ReportTesting(unittest.TestCase): 'testcases_list': [] } - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.dt_cfg') @patch.object(dt_report.Report, 'generate_json') @@ -432,7 +432,7 @@ class ReportTesting(unittest.TestCase): mock_generate.assert_called_once_with(testcase_list, duration) mock_save.assert_called_once_with(report_data) report.logger.info.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.dt_cfg') @patch.object(dt_report.Report, 'generate_json') @@ -458,7 +458,7 @@ class ReportTesting(unittest.TestCase): mock_generate.assert_called_once_with([], duration) mock_save.assert_called_once_with(report_data) report.logger.info.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json') @@ -558,9 +558,9 @@ class ReportTesting(unittest.TestCase): testcase_obj, 'check_results_files') logger_obj.debug.assert_called_once_with( 'Test case: validate -> result acquired') - self.assertEquals({'validate': 'result'}, - dt_report.Report.results['functest']) - self.assertEquals('result', result) + self.assertEqual({'validate': 'result'}, + dt_report.Report.results['functest']) + self.assertEqual('result', result) @patch('dovetail.report.CrawlerFactory') def test_get_result_no_result(self, mock_crawler): @@ -585,7 +585,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.increase_retry.assert_called_once_with() logger_obj.debug.assert_called_once_with( 'Test case: validate -> result acquired retry: retry') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.CrawlerFactory') def test_get_result_no_crawler(self, mock_crawler): @@ -605,7 +605,7 @@ class ReportTesting(unittest.TestCase): mock_crawler.create.assert_called_once_with('functest') logger_obj.error.assert_called_once_with( 'Crawler is None: name') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.dt_logger') def test_functest_crawler_create_log(self, mock_logger): @@ -616,7 +616,7 @@ class ReportTesting(unittest.TestCase): dt_report.FunctestCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.FunctestCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.FunctestCrawler.logger) @patch('dovetail.report.dt_cfg') @patch('dovetail.report.os.path') @@ -638,7 +638,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.name.assert_called_once_with() logger_obj.error.assert_called_once_with( 'Result file not found: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.json') @@ -693,7 +693,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.sub_testcase.assert_called_once_with() testcase_obj.name.assert_called_once_with() - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json') @@ -748,7 +748,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.sub_testcase.assert_called_once_with() testcase_obj.name.assert_called_once_with() - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -783,7 +783,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.name.assert_called_once_with() logger_obj.exception.assert_called_once_with( "Result data don't have key 'case_name'.") - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.dt_logger') def test_functestk8s_crawler_create_log(self, mock_logger): @@ -794,7 +794,7 @@ class ReportTesting(unittest.TestCase): dt_report.FunctestK8sCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.FunctestK8sCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.FunctestK8sCrawler.logger) @patch('dovetail.report.FunctestK8sCrawler.crawl_from_file') @patch('dovetail.report.dt_cfg') @@ -813,7 +813,7 @@ class ReportTesting(unittest.TestCase): dt_report.FunctestK8sCrawler.crawl_from_file.assert_called_once_with( 'testcase', 'file_path') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.dt_logger') def test_yardstick_crawler_create_log(self, mock_logger): @@ -824,7 +824,7 @@ class ReportTesting(unittest.TestCase): dt_report.YardstickCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.YardstickCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.YardstickCrawler.logger) @patch('dovetail.report.os.path') def test_yardstick_crawler_crawl_not_exists(self, mock_path): @@ -839,7 +839,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( 'Result file not found: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -881,7 +881,7 @@ class ReportTesting(unittest.TestCase): 'result.criteria', data_dict) testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -914,7 +914,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.set_results.assert_called_once_with(expected) logger_obj.exception.assert_called_once_with( "Pass flag not found 'result'") - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.dt_logger') def test_bottlenecks_crawler_create_log(self, mock_logger): @@ -925,7 +925,7 @@ class ReportTesting(unittest.TestCase): dt_report.BottlenecksCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.BottlenecksCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.BottlenecksCrawler.logger) @patch('dovetail.report.os.path') def test_bottlenecks_crawler_crawl_not_exists(self, mock_path): @@ -940,7 +940,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( 'Result file not found: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -968,7 +968,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') mock_loads.assert_called_once_with(file_obj) testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -996,7 +996,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') mock_loads.assert_called_once_with(file_obj) testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1023,7 +1023,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.set_results.assert_called_once_with(expected) logger_obj.exception.assert_called_once_with( "Pass flag not found 'data_body'") - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.report.os.path') def test_shell_crawler_crawl_not_exists(self, mock_path): @@ -1034,7 +1034,7 @@ class ReportTesting(unittest.TestCase): result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.os.path') @@ -1048,7 +1048,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) mock_open.assert_called_once_with(file_path, 'r') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.json.load') @@ -1067,7 +1067,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) mock_open.assert_called_once_with(file_path, 'r') mock_load.assert_called_once_with(file_obj) - self.assertEquals('result', result) + self.assertEqual('result', result) @patch('dovetail.report.dt_logger') def test_onapvtp_crawler_create_log(self, mock_logger): @@ -1078,7 +1078,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVtpCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.OnapVtpCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.OnapVtpCrawler.logger) @patch('dovetail.report.dt_logger') def test_onapvvp_crawler_create_log(self, mock_logger): @@ -1089,7 +1089,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVvpCrawler.create_log() - self.assertEquals(getlogger_obj, dt_report.OnapVvpCrawler.logger) + self.assertEqual(getlogger_obj, dt_report.OnapVvpCrawler.logger) @patch('dovetail.report.os.path') def test_onapvtp_crawler_crawl_not_exists(self, mock_path): @@ -1104,7 +1104,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( 'Result file not found: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.report.os.path') def test_onapvvp_crawler_crawl_not_exists(self, mock_path): @@ -1119,7 +1119,7 @@ class ReportTesting(unittest.TestCase): mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( 'Result file not found: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.report.os.path') @@ -1141,7 +1141,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') file_obj.read.assert_called_once_with() testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.os.path') @@ -1163,7 +1163,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') file_obj.read.assert_called_once_with() testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.os.path') @@ -1187,7 +1187,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVvpCrawler.logger.exception.assert_called_once_with( 'Result file has invalid format') testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.os.path') @@ -1211,7 +1211,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVvpCrawler.logger.exception.assert_called_once_with( "Outcome field not found 'outcome'") testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1241,7 +1241,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') mock_loads.assert_called_once_with(file_obj) testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1271,7 +1271,7 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') mock_loads.assert_called_once_with(file_obj) testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1303,7 +1303,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVtpCrawler.logger.error.assert_called_once_with( 'There is no property criteria.') testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1335,7 +1335,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVtpCrawler.logger.exception.assert_called_once_with( "Pass flag not found 'results'") testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('__builtin__.open') @patch('dovetail.report.json.loads') @@ -1358,17 +1358,17 @@ class ReportTesting(unittest.TestCase): mock_open.assert_called_once_with(file_path, 'r') mock_loads.assert_called_once_with(file_obj) testcase_obj.set_results.assert_called_once_with(expected) - self.assertEquals(expected, result) + self.assertEqual(expected, result) def test_crawler_factory(self): result = dt_report.CrawlerFactory.create('shell') - self.assertEquals(dt_report.ShellCrawler, result.__class__) + self.assertEqual(dt_report.ShellCrawler, result.__class__) def test_crawler_factory_none(self): - self.assertEquals(None, dt_report.CrawlerFactory.create('other')) + self.assertEqual(None, dt_report.CrawlerFactory.create('other')) def test_result_checker(self): - self.assertEquals('PASS', dt_report.ResultChecker.check()) + self.assertEqual('PASS', dt_report.ResultChecker.check()) @patch('dovetail.report.dt_logger') def test_functest_checker_create_log(self, mock_logger): @@ -1379,40 +1379,40 @@ class ReportTesting(unittest.TestCase): dt_report.FunctestChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.FunctestChecker.logger) + self.assertEqual(getlogger_obj, dt_report.FunctestChecker.logger) def test_functest_get_sub_testcase_no_result(self): - self.assertEquals( + self.assertEqual( False, dt_report.FunctestChecker.get_sub_testcase(None, None)) def test_functest_get_sub_testcase_simple_match(self): - self.assertEquals( + self.assertEqual( True, dt_report.FunctestChecker.get_sub_testcase('subt_a', ['subt_b', 'subt_a'])) def test_functest_get_sub_testcase_extended_match(self): - self.assertEquals( + self.assertEqual( True, dt_report.FunctestChecker.get_sub_testcase('subt_a', ['subt_b', 'subt_a+'])) def test_functest_get_sub_testcase_class_match(self): - self.assertEquals( + self.assertEqual( True, dt_report.FunctestChecker.get_sub_testcase('subclass_a.subt_a', ['subclass_a', 'subclass_b.subt_b'])) def test_functest_get_sub_testcase_class_no_match(self): - self.assertEquals( + self.assertEqual( False, dt_report.FunctestChecker.get_sub_testcase('subclass_a.subt_a', ['subclass_a.subt_a_a', 'subclass_b.subt_b'])) def test_functest_get_sub_no_match(self): - self.assertEquals( + self.assertEqual( False, dt_report.FunctestChecker.get_sub_testcase('subt_a', ['subt_b'])) @@ -1469,7 +1469,7 @@ class ReportTesting(unittest.TestCase): dt_report.FunctestK8sChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.FunctestK8sChecker.logger) + self.assertEqual(getlogger_obj, dt_report.FunctestK8sChecker.logger) @patch('dovetail.report.dt_logger') def test_yardstick_checker_create_log(self, mock_logger): @@ -1480,7 +1480,7 @@ class ReportTesting(unittest.TestCase): dt_report.YardstickChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.YardstickChecker.logger) + self.assertEqual(getlogger_obj, dt_report.YardstickChecker.logger) def test_yardstick_check_result(self): testcase_obj = Mock() @@ -1507,7 +1507,7 @@ class ReportTesting(unittest.TestCase): dt_report.BottlenecksChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.BottlenecksChecker.logger) + self.assertEqual(getlogger_obj, dt_report.BottlenecksChecker.logger) def test_bottlenecks_check_result(self): testcase_obj = Mock() @@ -1543,10 +1543,10 @@ class ReportTesting(unittest.TestCase): def test_checker_factory(self): result = dt_report.CheckerFactory.create('shell') - self.assertEquals(dt_report.ShellChecker, result.__class__) + self.assertEqual(dt_report.ShellChecker, result.__class__) def test_checker_factory_none(self): - self.assertEquals(None, dt_report.CheckerFactory.create('other')) + self.assertEqual(None, dt_report.CheckerFactory.create('other')) @patch('dovetail.report.dt_logger') def test_onapvtp_checker_create_log(self, mock_logger): @@ -1557,7 +1557,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVtpChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.OnapVtpChecker.logger) + self.assertEqual(getlogger_obj, dt_report.OnapVtpChecker.logger) def test_onapvtp_check_result_none(self): testcase_obj = Mock() @@ -1584,7 +1584,7 @@ class ReportTesting(unittest.TestCase): dt_report.OnapVvpChecker.create_log() - self.assertEquals(getlogger_obj, dt_report.OnapVvpChecker.logger) + self.assertEqual(getlogger_obj, dt_report.OnapVvpChecker.logger) def test_onapvvp_check_result_none(self): testcase_obj = Mock() diff --git a/dovetail/tests/unit/test_run.py b/dovetail/tests/unit/test_run.py index 0604c8ed..b2d618a2 100644 --- a/dovetail/tests/unit/test_run.py +++ b/dovetail/tests/unit/test_run.py @@ -46,7 +46,7 @@ class RunTesting(unittest.TestCase): mock_testsuite.load.assert_called_once_with() mock_testsuite.get.assert_called_once_with('testsuite') - self.assertEquals('suite_a', result) + self.assertEqual('suite_a', result) @patch('dovetail.run.dt_report.Report') def test_run_test_no_list(self, mock_report): @@ -182,14 +182,14 @@ class RunTesting(unittest.TestCase): result = dt_run.filter_config(input_dict, Mock()) - self.assertEquals(expected_dict, result) + self.assertEqual(expected_dict, result) @patch('dovetail.run.dt_cfg') def test_filter_config_none(self, mock_config): mock_config.dovetail_config = {'cli': {}} result = dt_run.filter_config({}, Mock()) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.run.dt_cfg') def test_filter_config_keyerror(self, mock_config): @@ -291,8 +291,8 @@ class RunTesting(unittest.TestCase): 'config_dir': 'pre_config_path', 'patch_dir': 'patch_set_path', 'userconfig_dir': 'userconfig_dir'} - self.assertEquals(expected_dict, mock_config.dovetail_config) - self.assertEquals(dovetail_home, result) + self.assertEqual(expected_dict, mock_config.dovetail_config) + self.assertEqual(dovetail_home, result) @patch('dovetail.run.os') def test_get_result_path_exception(self, mock_os): @@ -300,7 +300,7 @@ class RunTesting(unittest.TestCase): result = dt_run.get_result_path() - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.run.constants') @patch('dovetail.run.dt_cfg') @@ -346,7 +346,7 @@ class RunTesting(unittest.TestCase): dt_run.update_deploy_scenario(logger, deploy_scenario='a') logger.info.assert_called_once_with('DEPLOY_SCENARIO : %s', 'a') - self.assertEquals({'DEPLOY_SCENARIO': 'a'}, mock_os.environ) + self.assertEqual({'DEPLOY_SCENARIO': 'a'}, mock_os.environ) @patch('dovetail.run.dt_cfg') @patch.object(dt_run, 'filter_config') @@ -372,7 +372,7 @@ class RunTesting(unittest.TestCase): logger.warning.assert_called_once_with( 'Strict API response validation DISABLED.') - self.assertEquals(expected_dict, mock_config.dovetail_config) + self.assertEqual(expected_dict, mock_config.dovetail_config) @patch('dovetail.run.dt_cfg') @patch.object(dt_run, 'filter_config') @@ -394,7 +394,7 @@ class RunTesting(unittest.TestCase): 'no_api_validation': False } - self.assertEquals(expected_dict, mock_config.dovetail_config) + self.assertEqual(expected_dict, mock_config.dovetail_config) def test_check_testcase_list_not_in_list(self): logger = Mock() @@ -403,7 +403,7 @@ class RunTesting(unittest.TestCase): logger.error.assert_called_once_with( 'Test case testcase is not defined.') - self.assertEquals(None, result) + self.assertEqual(None, result) def test_check_testcase_list_none(self): logger = Mock() @@ -411,7 +411,7 @@ class RunTesting(unittest.TestCase): logger.error.assert_called_once_with( 'There is no test case to be executed.') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.run.dt_testcase.Testcase') def test_check_testcase_list(self, mock_testcase): @@ -420,7 +420,7 @@ class RunTesting(unittest.TestCase): result = dt_run.check_testcase_list(testcase_list) - self.assertEquals(testcase_list, result) + self.assertEqual(testcase_list, result) @patch('dovetail.run.dt_testcase.Testcase') @patch.object(dt_run, 'check_testcase_list') @@ -432,7 +432,7 @@ class RunTesting(unittest.TestCase): mock_check.assert_called_once_with(testcase_list, None) mock_testcase.load.assert_called_once_with() - self.assertEquals(testcase_list, result) + self.assertEqual(testcase_list, result) @patch('dovetail.run.dt_cfg') @patch('dovetail.run.dt_testcase.Testcase') @@ -456,7 +456,7 @@ class RunTesting(unittest.TestCase): mock_testcase.get_testcases_for_testsuite.assert_called_once_with( 'testsuite_yaml', 'area') mock_check.assert_called_once_with(testcase_list, None) - self.assertEquals(testcase_list, result) + self.assertEqual(testcase_list, result) @patch('dovetail.run.dt_cfg') @patch('dovetail.run.dt_testcase.Testcase') @@ -472,7 +472,7 @@ class RunTesting(unittest.TestCase): mock_testcase.check_testarea.assert_called_once_with('area') logger.error.assert_called_once_with( 'Test suite suite is not defined.') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.run.dt_cfg') @patch('dovetail.run.dt_testcase.Testcase') @@ -488,7 +488,7 @@ class RunTesting(unittest.TestCase): mock_testcase.check_testarea.assert_called_once_with('area') logger.error.assert_called_once_with( 'Test area area is not defined.') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.run.os') @@ -540,13 +540,13 @@ class RunTesting(unittest.TestCase): logger_temp_obj.getLogger.assert_called_once_with() mock_logger.Logger.assert_called_once_with('run') mock_uuid.uuid1.assert_called_once_with() - self.assertEquals({'build_tag': 'daily-master-42'}, - mock_config.dovetail_config) + self.assertEqual({'build_tag': 'daily-master-42'}, + mock_config.dovetail_config) mock_get_result.assert_called_once_with() mock_clean.assert_called_once_with() - self.assertEquals({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true', - 'OPNFV_CI': 'true', 'validation': 'enabled'}, - mock_os.environ) + self.assertEqual({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true', + 'OPNFV_CI': 'true', 'validation': 'enabled'}, + mock_os.environ) mock_create_logs.assert_called_once_with() logger_obj.info.assert_has_calls([ call('================================================'), @@ -561,7 +561,7 @@ class RunTesting(unittest.TestCase): mock_get_list.assert_called_once_with(logger_obj, **kwargs_dict) mock_run.assert_called_once_with( testcase_list, kwargs_dict['report'], logger_obj) - self.assertEquals(expected.code, 0) + self.assertEqual(expected.code, 0) @patch('dovetail.run.uuid') @patch('dovetail.run.dt_cfg') @@ -577,10 +577,10 @@ class RunTesting(unittest.TestCase): expected = cm.exception mock_uuid.uuid1.assert_called_once_with() - self.assertEquals({'build_tag': 'daily-master-42'}, - mock_config.dovetail_config) + self.assertEqual({'build_tag': 'daily-master-42'}, + mock_config.dovetail_config) mock_get_result.assert_called_once_with() - self.assertEquals(expected.code, 0) + self.assertEqual(expected.code, 0) @patch('__builtin__.open') @patch('dovetail.run.json') @@ -629,18 +629,18 @@ class RunTesting(unittest.TestCase): dt_run.main([ '--testsuite=testsuite', '--debug', '--report', '2.0.0']) expected = cm.exception - self.assertEquals(expected.code, 2) + self.assertEqual(expected.code, 2) logger_temp_obj.getLogger.assert_called_once_with() mock_logger.Logger.assert_called_once_with('run') mock_uuid.uuid1.assert_called_once_with() - self.assertEquals({'build_tag': 'daily-master-42'}, - mock_config.dovetail_config) + self.assertEqual({'build_tag': 'daily-master-42'}, + mock_config.dovetail_config) mock_get_result.assert_called_once_with() mock_clean.assert_called_once_with() - self.assertEquals({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true', - 'OPNFV_CI': 'false', 'validation': 'enabled'}, - mock_os.environ) + self.assertEqual({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true', + 'OPNFV_CI': 'false', 'validation': 'enabled'}, + mock_os.environ) mock_create_logs.assert_called_once_with() logger_obj.info.assert_has_calls([ call('================================================'), diff --git a/dovetail/tests/unit/test_test_runner.py b/dovetail/tests/unit/test_test_runner.py index a40e3cb1..4bf97132 100644 --- a/dovetail/tests/unit/test_test_runner.py +++ b/dovetail/tests/unit/test_test_runner.py @@ -223,7 +223,7 @@ class TestRunnerTesting(unittest.TestCase): mock_utils.get_value_from_dict.assert_has_calls([ call('report.source_archive_files', self.testcase_dict), call('report.dest_archive_files', self.testcase_dict)]) - self.assertEquals(True, result) + self.assertEqual(True, result) @patch('dovetail.test_runner.dt_cfg') @patch('dovetail.test_runner.dt_utils') @@ -246,7 +246,7 @@ class TestRunnerTesting(unittest.TestCase): "Can't find corresponding 'result_dest_files' " "for 'result_source_files' with testcase {}" .format(self.testcase_name)) - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('dovetail.test_runner.dt_cfg') @patch('dovetail.test_runner.dt_utils') @@ -275,7 +275,7 @@ class TestRunnerTesting(unittest.TestCase): mock_os.path.isfile.assert_has_calls([call('src_file_path')]) docker_runner.logger.error.assert_called_once_with( "Can't find file {}.".format('src_file_path')) - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('dovetail.test_runner.dt_cfg') @patch('dovetail.test_runner.dt_utils') @@ -304,7 +304,7 @@ class TestRunnerTesting(unittest.TestCase): mock_os.path.isfile.assert_has_calls([call('src_file_path')]) mock_os.renames.assert_called_once_with( 'src_file_path', 'dest_file_path') - self.assertEquals(True, result) + self.assertEqual(True, result) @patch('dovetail.test_runner.jinja2') def test_render(self, mock_jinja): @@ -317,7 +317,7 @@ class TestRunnerTesting(unittest.TestCase): mock_jinja.Template.assert_called_once_with('task_template') template_obj.render.assert_called_with() - self.assertEquals(render_obj, result) + self.assertEqual(render_obj, result) @patch('dovetail.test_runner.dt_cfg') @patch('dovetail.test_runner.os') @@ -345,7 +345,7 @@ class TestRunnerTesting(unittest.TestCase): call('OS_INSECURE'), call('DOVETAIL_HOME'), call('DEBUG'), call('OS_CACERT'), call('HOST_URL'), call('CSAR_FILE'), call('VNF_ARCHIVE_NAME')]) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @patch('dovetail.test_runner.dt_utils') @patch('dovetail.test_runner.dt_cfg') @@ -371,7 +371,7 @@ class TestRunnerTesting(unittest.TestCase): call('conf_path', docker_runner.config_file_name)]) mock_utils.read_plain_file.assert_called_once_with( 'config_file', docker_runner.logger) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.test_runner.yaml.safe_load') @patch('dovetail.test_runner.dt_utils') @@ -406,7 +406,7 @@ class TestRunnerTesting(unittest.TestCase): mock_add_info.assert_called_once_with(self.testcase) mock_render.assert_called_once_with(True, config_item='item') mock_load.assert_called_once_with('full_task') - self.assertEquals( + self.assertEqual( {'config_dir': 'one', 'pod_file': 'two', 'full_task_yaml': 'full_value', @@ -446,7 +446,7 @@ class TestRunnerTesting(unittest.TestCase): mock_add_info.assert_called_once_with(self.testcase) mock_render.assert_called_once_with(True, config_item='item') mock_load.assert_called_once_with('full_task') - self.assertEquals( + self.assertEqual( {'config_dir': 'one', 'pod_file': 'two', 'full_task_yaml': 'full_value', @@ -492,7 +492,7 @@ class TestRunnerTesting(unittest.TestCase): "Need key '{}' in {}".format('testcase_name', {'key': 'value'})) mock_render.assert_called_once_with(True, config_item='item') mock_load.assert_called_once_with('full_task') - self.assertEquals( + self.assertEqual( {'config_dir': 'one', 'pod_file': 'two', 'full_task_yaml': 'full_value', @@ -585,7 +585,7 @@ class TestRunnerTesting(unittest.TestCase): result = docker_runner.create(self.testcase) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.test_runner.constants') @patch('dovetail.test_runner.dt_utils') @@ -606,7 +606,7 @@ class TestRunnerTesting(unittest.TestCase): call('conf_path', docker_runner.config_file_name)]) mock_utils.read_plain_file.assert_has_calls([ call('config_file', docker_runner.logger)]) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.test_runner.yaml.safe_load') @patch('dovetail.test_runner.constants') @@ -639,7 +639,7 @@ class TestRunnerTesting(unittest.TestCase): mock_add_info.assert_has_calls([call(self.testcase)]) mock_render.assert_has_calls([call(True, config_item='item')]) mock_load.assert_has_calls([call('full_task')]) - self.assertEquals( + self.assertEqual( {'config_dir': 'one', 'pod_file': 'two', 'full_task_yaml': 'full_value'}, diff --git a/dovetail/tests/unit/test_testcase.py b/dovetail/tests/unit/test_testcase.py index 5f4f15d9..fc949fee 100644 --- a/dovetail/tests/unit/test_testcase.py +++ b/dovetail/tests/unit/test_testcase.py @@ -43,7 +43,7 @@ class TestcaseTesting(unittest.TestCase): tcase.Testcase.create_log() - self.assertEquals(getlogger_obj, tcase.Testcase.logger) + self.assertEqual(getlogger_obj, tcase.Testcase.logger) @patch('dovetail.testcase.Parser') def test_parse_cmd_no_lines(self, mock_parser): @@ -55,7 +55,7 @@ class TestcaseTesting(unittest.TestCase): mock_parser.parse_cmd.assert_called_once_with( 'cmd', testcase) - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('dovetail.testcase.Parser') def test_parse_cmd(self, mock_parser): @@ -70,8 +70,8 @@ class TestcaseTesting(unittest.TestCase): mock_parser.parse_cmd.assert_called_once_with( 'cmd', testcase) logger_obj.debug.assert_called_once_with("cmds: ['cmd_lines']") - self.assertEquals(['cmd_lines'], testcase.cmds) - self.assertEquals(True, result) + self.assertEqual(['cmd_lines'], testcase.cmds) + self.assertEqual(True, result) @patch('dovetail.testcase.dt_cfg') def test_prepare_cmd_no_cmds(self, mock_config): @@ -84,7 +84,7 @@ class TestcaseTesting(unittest.TestCase): logger_obj.error.assert_called_once_with( 'Test case {} has no cmds.'.format(testcase.name())) - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('dovetail.testcase.dt_cfg') @patch.object(tcase.Testcase, 'parse_cmd') @@ -97,7 +97,7 @@ class TestcaseTesting(unittest.TestCase): result = testcase.prepare_cmd('type') mock_parse.assert_called_once_with(['cmd']) - self.assertEquals(True, result) + self.assertEqual(True, result) @patch('dovetail.testcase.dt_cfg') @patch.object(tcase.Testcase, 'parse_cmd') @@ -110,14 +110,14 @@ class TestcaseTesting(unittest.TestCase): result = testcase.prepare_cmd('type') mock_parse.assert_called_once_with(['cmd']) - self.assertEquals(True, result) + self.assertEqual(True, result) def test_str(self): testcase = tcase.OnapVtpTestcase(self.testcase_yaml) result = testcase.__str__() - self.assertEquals(testcase.testcase, result) + self.assertEqual(testcase.testcase, result) def test_objective(self): testcase = tcase.OnapVvpTestcase(self.testcase_yaml) @@ -125,7 +125,7 @@ class TestcaseTesting(unittest.TestCase): result = testcase.objective() - self.assertEquals('objective', result) + self.assertEqual('objective', result) @patch('dovetail.testcase.dt_utils') def test_sub_testcase(self, mock_utils): @@ -136,7 +136,7 @@ class TestcaseTesting(unittest.TestCase): mock_utils.get_value_from_dict.assert_called_once_with( 'report.sub_testcase_list', testcase.testcase) - self.assertEquals('value', result) + self.assertEqual('value', result) def test_sub_testcase_passed(self): testcase = tcase.Testcase(self.testcase_yaml) @@ -145,49 +145,49 @@ class TestcaseTesting(unittest.TestCase): result = testcase.sub_testcase_passed('name', 'passed') - self.assertEquals('passed', result) + self.assertEqual('passed', result) def test_validate_type(self): testcase = tcase.Testcase(self.testcase_yaml) result = testcase.validate_type() - self.assertEquals('functest', result) + self.assertEqual('functest', result) def test_validate_testcase(self): testcase = tcase.Testcase(self.testcase_yaml) result = testcase.validate_testcase() - self.assertEquals('tempest_smoke_serial', result) + self.assertEqual('tempest_smoke_serial', result) def test_portal_key_file(self): testcase = tcase.Testcase(self.testcase_yaml) result = testcase.portal_key_file() - self.assertEquals('tempest_logs/tempest_smoke_serial.html', result) + self.assertEqual('tempest_logs/tempest_smoke_serial.html', result) def test_vnf_type(self): testcase = tcase.OnapVtpTestcase(self.testcase_yaml) result = testcase.vnf_type() - self.assertEquals('tosca', result) + self.assertEqual('tosca', result) def test_passed(self): testcase = tcase.Testcase(self.testcase_yaml) result = testcase.passed('passed') - self.assertEquals('passed', result) + self.assertEqual('passed', result) def test_set_get_results(self): testcase = tcase.Testcase(self.testcase_yaml) testcase.set_results('results') - self.assertEquals('results', testcase.get_results()) + self.assertEqual('results', testcase.get_results()) def test_pre_condition_exists(self): testcase = tcase.Testcase(self.testcase_yaml) @@ -195,7 +195,7 @@ class TestcaseTesting(unittest.TestCase): result = testcase.pre_condition() - self.assertEquals('pre_condition', result) + self.assertEqual('pre_condition', result) @patch.object(tcase.Testcase, 'pre_condition_cls') def test_pre_condition_not_exists(self, mock_pre_condition): @@ -209,7 +209,7 @@ class TestcaseTesting(unittest.TestCase): mock_pre_condition.assert_called_once_with('functest') logger_obj.debug.assert_called_once_with( 'Test case: {} pre_condition is empty.'.format(testcase.name())) - self.assertEquals(False, result) + self.assertEqual(False, result) def test_pre_copy_path(self): testcase = tcase.Testcase(self.testcase_yaml) @@ -217,14 +217,14 @@ class TestcaseTesting(unittest.TestCase): result = testcase.pre_copy_path('key') - self.assertEquals('value', result) + self.assertEqual('value', result) def test_pre_copy_path_error(self): testcase = tcase.Testcase(self.testcase_yaml) result = testcase.pre_copy_path('key') - self.assertEquals(None, result) + self.assertEqual(None, result) def test_post_condition_exists(self): testcase = tcase.Testcase(self.testcase_yaml) @@ -232,7 +232,7 @@ class TestcaseTesting(unittest.TestCase): result = testcase.post_condition() - self.assertEquals('post_condition', result) + self.assertEqual('post_condition', result) @patch.object(tcase.Testcase, 'post_condition_cls') def test_post_condition_not_exists(self, mock_post_condition): @@ -246,7 +246,7 @@ class TestcaseTesting(unittest.TestCase): mock_post_condition.assert_called_once_with('functest') logger_obj.debug.assert_called_once_with( 'Test case: {} post_condition is empty.'.format(testcase.name())) - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('__builtin__.open') @patch('dovetail.testcase.os.path') @@ -272,7 +272,7 @@ class TestcaseTesting(unittest.TestCase): file_obj.write.assert_called_once_with(sub_test + '\n') logger_obj.debug.assert_called_once_with( 'Save test cases to {}'.format(file_path)) - self.assertEquals(file_path, result) + self.assertEqual(file_path, result) @patch('__builtin__.open') @patch('dovetail.testcase.os.path') @@ -295,7 +295,7 @@ class TestcaseTesting(unittest.TestCase): mock_path.join.assert_called_once_with('value', 'tempest_custom.txt') mock_open.assert_called_once_with(file_path, 'w+') logger_obj.exception('Failed to save: {}'.format(file_path)) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.testcase.TestRunnerFactory') def test_run(self, mock_factory): @@ -319,28 +319,28 @@ class TestcaseTesting(unittest.TestCase): mock_config.dovetail_config = {'type': {'pre_condition': 'value'}} result = tcase.Testcase.pre_condition_cls('type') - self.assertEquals('value', result) + self.assertEqual('value', result) @patch('dovetail.testcase.dt_cfg') def test_pre_condition_cls_key_error(self, mock_config): mock_config.dovetail_config = {} result = tcase.Testcase.pre_condition_cls('type') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.testcase.dt_cfg') def test_post_condition_cls(self, mock_config): mock_config.dovetail_config = {'type': {'post_condition': 'value'}} result = tcase.Testcase.post_condition_cls('type') - self.assertEquals('value', result) + self.assertEqual('value', result) @patch('dovetail.testcase.dt_cfg') def test_post_condition_cls_key_error(self, mock_config): mock_config.dovetail_config = {} result = tcase.Testcase.post_condition_cls('type') - self.assertEquals(None, result) + self.assertEqual(None, result) def test_increase_retry(self): testcase = tcase.Testcase(self.testcase_yaml) @@ -349,7 +349,7 @@ class TestcaseTesting(unittest.TestCase): for _ in range(0, 42): result = testcase.increase_retry() - self.assertEquals(42, result) + self.assertEqual(42, result) @patch('__builtin__.open') @patch('dovetail.testcase.yaml') @@ -376,7 +376,7 @@ class TestcaseTesting(unittest.TestCase): mock_open.assert_called_once_with('testcase_path') mock_yaml.safe_load.assert_called_once_with(file_obj) mock_factory.create.assert_called_once_with('value', yaml_dict) - self.assertEquals(runner_obj, tcase.Testcase.get('key')) + self.assertEqual(runner_obj, tcase.Testcase.get('key')) @patch('__builtin__.open') @patch('dovetail.testcase.yaml') @@ -407,33 +407,33 @@ class TestcaseTesting(unittest.TestCase): 'Failed to create test case: file') def test_get_none(self): - self.assertEquals(None, tcase.Testcase.get('unknown')) + self.assertEqual(None, tcase.Testcase.get('unknown')) def test_check_testarea_none(self): - self.assertEquals((True, ['full']), - tcase.Testcase.check_testarea(None)) + self.assertEqual((True, ['full']), + tcase.Testcase.check_testarea(None)) @patch('dovetail.testcase.dt_cfg') def test_check_testarea_full(self, mock_config): - self.assertEquals((True, ['full']), - tcase.Testcase.check_testarea(['full'])) + self.assertEqual((True, ['full']), + tcase.Testcase.check_testarea(['full'])) @patch('dovetail.testcase.dt_cfg') def test_check_testarea(self, mock_config): - self.assertEquals((True, ['area']), - tcase.Testcase.check_testarea(['area'])) + self.assertEqual((True, ['area']), + tcase.Testcase.check_testarea(['area'])) def test_check_testcase_area(self): - self.assertEquals(False, - tcase.Testcase.check_testcase_area(None, None)) + self.assertEqual(False, + tcase.Testcase.check_testcase_area(None, None)) def test_check_testcase_area_full_or_in_testcase(self): - self.assertEquals(True, - tcase.Testcase.check_testcase_area(['full'], 'full')) + self.assertEqual(True, + tcase.Testcase.check_testcase_area(['full'], 'full')) def test_check_testcase_area_not_in_testcase_or_full(self): - self.assertEquals(False, - tcase.Testcase.check_testcase_area(['full'], 'half')) + self.assertEqual(False, + tcase.Testcase.check_testcase_area(['full'], 'half')) @patch('dovetail.testcase.dt_utils') def test_get_testcases_for_testsuite_no_testcases(self, mock_utils): @@ -445,7 +445,7 @@ class TestcaseTesting(unittest.TestCase): call('testcases_list', 'suite'), call('mandatory', None), call('optional', None)]) - self.assertEquals([], result) + self.assertEqual([], result) @patch('dovetail.testcase.dt_cfg') @patch('dovetail.testcase.dt_utils') @@ -474,7 +474,7 @@ class TestcaseTesting(unittest.TestCase): .format(testsuite['name'])), call('There is no optional test case in test suite {}' .format(testsuite['name']))]) - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('dovetail.testcase.dt_cfg') @patch('dovetail.testcase.dt_utils') @@ -508,10 +508,10 @@ class TestcaseTesting(unittest.TestCase): mock_check.assert_has_calls([ call('mandatory', 'area'), call('optional', 'area')]) - self.assertEquals(['mandatory', 'optional'], result) - self.assertEquals( + self.assertEqual(['mandatory', 'optional'], result) + self.assertEqual( True, tcase.Testcase.testcase_list['mandatory'].is_mandatory) - self.assertEquals( + self.assertEqual( False, tcase.Testcase.testcase_list['optional'].is_mandatory) @patch('dovetail.testcase.dt_cfg') @@ -546,13 +546,12 @@ class TestcaseTesting(unittest.TestCase): mock_check.assert_has_calls([ call('mandatory', 'area'), call('optional', 'area')]) - self.assertEquals(['mandatory', 'optional'], result) - self.assertEquals(True, - tcase.Testcase.testcase_list['mandatory'] - .is_mandatory) - self.assertEquals(False, - tcase.Testcase.testcase_list['optional'] - .is_mandatory) + self.assertEqual(['mandatory', 'optional'], result) + self.assertEqual(True, + tcase.Testcase.testcase_list['mandatory'] + .is_mandatory) + self.assertEqual(False, + tcase.Testcase.testcase_list['optional'].is_mandatory) @patch.object(tcase.Testcase, 'prepare_cmd') def test_functest_case_prepare_cmd_false(self, mock_prepare): @@ -562,7 +561,7 @@ class TestcaseTesting(unittest.TestCase): result = testcase.prepare_cmd('type') mock_prepare.assert_called_once_with('type') - self.assertEquals(False, result) + self.assertEqual(False, result) @patch('dovetail.testcase.os.path') @patch('dovetail.testcase.dt_cfg') @@ -586,18 +585,18 @@ class TestcaseTesting(unittest.TestCase): 'Updated list of commands for test run with ' 'disabled API response validation: {}' .format(testcase.cmds)) - self.assertEquals(['patch_cmd'], testcase.cmds) - self.assertEquals(True, result) + self.assertEqual(['patch_cmd'], testcase.cmds) + self.assertEqual(True, result) def test_testfactory_error(self): - self.assertEquals(None, - tcase.TestcaseFactory.create('unknown', - self.testcase_yaml)) + self.assertEqual(None, + tcase.TestcaseFactory.create('unknown', + self.testcase_yaml)) def test_testfactory_k8s(self): k8s_testcase = tcase.TestcaseFactory.create('functest-k8s', self.testcase_yaml) - self.assertEquals('functest-k8s', k8s_testcase.type) + self.assertEqual('functest-k8s', k8s_testcase.type) @patch('dovetail.testcase.dt_logger') def test_testsuite_create_log(self, mock_logger): @@ -608,7 +607,7 @@ class TestcaseTesting(unittest.TestCase): tcase.Testsuite.create_log() - self.assertEquals(getlogger_obj, tcase.Testsuite.logger) + self.assertEqual(getlogger_obj, tcase.Testsuite.logger) def test_testsuite_get_test(self): suite = tcase.Testsuite('suite') @@ -616,14 +615,14 @@ class TestcaseTesting(unittest.TestCase): result = suite.get_test('testcase') - self.assertEquals('value', result) + self.assertEqual('value', result) def test_testsuite_get_test_not_exists(self): suite = tcase.Testsuite('suite') result = suite.get_test('testcase') - self.assertEquals(None, result) + self.assertEqual(None, result) @patch('__builtin__.open') @patch('dovetail.testcase.yaml') @@ -644,16 +643,16 @@ class TestcaseTesting(unittest.TestCase): mock_os.path.join.assert_called_with('root', 'file') mock_open.assert_called_once_with('file_path') mock_yaml.safe_load.assert_called_once_with(file_obj) - self.assertEquals({'testsuite': 'value'}, - tcase.Testsuite.testsuite_list) + self.assertEqual({'testsuite': 'value'}, + tcase.Testsuite.testsuite_list) def test_testsuite_get_none(self): - self.assertEquals(None, tcase.Testsuite.get('unknown')) + self.assertEqual(None, tcase.Testsuite.get('unknown')) def test_testsuite_get(self): tcase.Testsuite.testsuite_list.update({'key': 'value'}) - self.assertEquals('value', tcase.Testsuite.get('key')) + self.assertEqual('value', tcase.Testsuite.get('key')) def test_testsuite_get_all(self): tcase.Testsuite.testsuite_list.update({'key': 'value'}) - self.assertEquals({'key': 'value'}, tcase.Testsuite.get_all()) + self.assertEqual({'key': 'value'}, tcase.Testsuite.get_all()) diff --git a/dovetail/tests/unit/utils/test_dovetail_config.py b/dovetail/tests/unit/utils/test_dovetail_config.py index c7ac5b96..8e835f49 100644 --- a/dovetail/tests/unit/utils/test_dovetail_config.py +++ b/dovetail/tests/unit/utils/test_dovetail_config.py @@ -39,7 +39,7 @@ class DovetailConfigTesting(unittest.TestCase): dovetail_cfg.set_leaf_dict(dict_to_test, ['aa', 'bb', 'cc'], 'val') - self.assertEquals({'aa': {'bb': {'cc': 'val'}}}, dict_to_test) + self.assertEqual({'aa': {'bb': {'cc': 'val'}}}, dict_to_test) @patch.object(DovetailConfig, 'set_leaf_dict') @patch.object(DovetailConfig, 'dovetail_config') diff --git a/dovetail/tests/unit/utils/test_dovetail_logger.py b/dovetail/tests/unit/utils/test_dovetail_logger.py index a8867890..a70c0503 100644 --- a/dovetail/tests/unit/utils/test_dovetail_logger.py +++ b/dovetail/tests/unit/utils/test_dovetail_logger.py @@ -49,7 +49,7 @@ class DovetailLoggerTesting(unittest.TestCase): logger_name = 'name' dovetail_logger = Logger(logger_name) mock_logging.getLogger.assert_called_once_with(logger_name) - self.assertEquals(dovetail_logger.logger.propagate, 0) + self.assertEqual(dovetail_logger.logger.propagate, 0) logger.setLevel.assert_called_once_with(level_const_debug) mock_os.path.exists.assert_called_once_with(file_path) # mock_os.makedirs.assert_called_once_with(file_path) @@ -60,7 +60,7 @@ class DovetailLoggerTesting(unittest.TestCase): file_handler_obj.setLevel.assert_called_once_with(level_const_info) logger.addHandler.assert_has_calls([ call(stream_handler_obj), call(file_handler_obj)]) - self.assertEquals(dovetail_logger.getLogger(), logger) + self.assertEqual(dovetail_logger.getLogger(), logger) @patch('sys.stdout') @patch('dovetail.utils.dovetail_logger.os') @@ -84,7 +84,7 @@ class DovetailLoggerTesting(unittest.TestCase): logger_name = 'name' dovetail_logger = Logger(logger_name) mock_logging.getLogger.assert_called_once_with(logger_name) - self.assertEquals(dovetail_logger.logger.propagate, 0) + self.assertEqual(dovetail_logger.logger.propagate, 0) logger.setLevel.assert_called_once_with(level_const_debug) mock_os.path.exists.assert_called_once_with(file_path) # mock_os.makedirs.assert_called_once_with(file_path) @@ -95,4 +95,4 @@ class DovetailLoggerTesting(unittest.TestCase): file_handler_obj.setLevel.assert_called_once_with(level_const_debug) logger.addHandler.assert_has_calls([ call(stream_handler_obj), call(file_handler_obj)]) - self.assertEquals(dovetail_logger.getLogger(), logger) + self.assertEqual(dovetail_logger.getLogger(), logger) |