diff options
Diffstat (limited to 'dovetail/tests/unit/test_report.py')
-rw-r--r-- | dovetail/tests/unit/test_report.py | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/dovetail/tests/unit/test_report.py b/dovetail/tests/unit/test_report.py index acd44141..9d3acbfd 100644 --- a/dovetail/tests/unit/test_report.py +++ b/dovetail/tests/unit/test_report.py @@ -82,7 +82,7 @@ class ReportTesting(unittest.TestCase): inner_testcase_obj = Mock() testcase_obj.testcase = inner_testcase_obj mock_config.dovetail_config = {'result_dir': 'result_dir'} - mock_utils.get_value_from_dict.return_value = 'check_results_file' + mock_utils.get_value_from_dict.return_value = ['check_results_file'] mock_path.join.return_value = 'results_file' mock_path.isfile.return_value = True mock_get.return_value = 'result' @@ -90,13 +90,13 @@ class ReportTesting(unittest.TestCase): result = report.check_tc_result(testcase_obj) mock_utils.get_value_from_dict.assert_called_once_with( - 'report.check_results_file', inner_testcase_obj) + 'report.check_results_files', inner_testcase_obj) mock_path.join.assert_called_once_with( 'result_dir', 'check_results_file') mock_path.isfile.assert_called_once_with('results_file') logger_obj.info.assert_called_once_with( - 'Results have been stored with file results_file.') - mock_get.assert_called_once_with(testcase_obj, 'results_file') + '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) @@ -114,14 +114,14 @@ class ReportTesting(unittest.TestCase): inner_testcase_obj = Mock() testcase_obj.testcase = inner_testcase_obj mock_config.dovetail_config = {'result_dir': 'result_dir'} - mock_utils.get_value_from_dict.return_value = 'check_results_file' + mock_utils.get_value_from_dict.return_value = ['check_results_file'] mock_path.join.return_value = 'results_file' mock_path.isfile.return_value = False result = report.check_tc_result(testcase_obj) mock_utils.get_value_from_dict.assert_called_once_with( - 'report.check_results_file', inner_testcase_obj) + 'report.check_results_files', inner_testcase_obj) mock_path.join.assert_called_once_with( 'result_dir', 'check_results_file') mock_path.isfile.assert_called_once_with('results_file') @@ -150,9 +150,9 @@ class ReportTesting(unittest.TestCase): result = report.check_tc_result(testcase_obj) mock_utils.get_value_from_dict.assert_called_once_with( - 'report.check_results_file', inner_testcase_obj) + 'report.check_results_files', inner_testcase_obj) logger_obj.error.assert_called_once_with( - "Failed to get 'check_results_file' from config " + "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) @@ -411,13 +411,13 @@ class ReportTesting(unittest.TestCase): mock_crawler.create.return_value = crawler_obj crawler_obj.crawl.return_value = 'result' - result = report.get_result(testcase_obj, 'check_results_file') + result = report.get_result(testcase_obj, 'check_results_files') testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.validate_type.assert_called_once_with() mock_crawler.create.assert_called_once_with('functest') crawler_obj.crawl.assert_called_once_with( - testcase_obj, 'check_results_file') + testcase_obj, 'check_results_files') logger_obj.debug.assert_called_once_with( 'Test case: validate -> result acquired') self.assertEquals({'validate': 'result'}, @@ -437,13 +437,13 @@ class ReportTesting(unittest.TestCase): mock_crawler.create.return_value = crawler_obj crawler_obj.crawl.return_value = None - result = report.get_result(testcase_obj, 'check_results_file') + result = report.get_result(testcase_obj, 'check_results_files') testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.validate_type.assert_called_once_with() mock_crawler.create.assert_called_once_with('functest') crawler_obj.crawl.assert_called_once_with( - testcase_obj, 'check_results_file') + testcase_obj, 'check_results_files') testcase_obj.increase_retry.assert_called_once_with() logger_obj.debug.assert_called_once_with( 'Test case: validate -> result acquired retry: retry') @@ -460,7 +460,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.validate_type.return_value = 'functest' mock_crawler.create.return_value = None - result = report.get_result(testcase_obj, 'check_results_file') + result = report.get_result(testcase_obj, 'check_results_files') testcase_obj.validate_testcase.assert_called_once_with() testcase_obj.validate_type.assert_called_once_with() @@ -493,7 +493,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.name.return_value = 'name' crawler = dt_report.FunctestCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) mock_path.exists.assert_called_once_with(file_path) testcase_obj.validate_testcase.assert_called_once_with() @@ -538,7 +538,7 @@ class ReportTesting(unittest.TestCase): mock_utils.get_duration.return_value = 'duration' crawler = dt_report.FunctestCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'criteria', 'timestart': 'start_date', 'timestop': 'stop_date', 'duration': 'duration', 'details': { @@ -580,7 +580,7 @@ class ReportTesting(unittest.TestCase): mock_utils.get_duration.return_value = 'duration' crawler = dt_report.FunctestCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) mock_path.exists.assert_called_once_with(file_path) mock_open.assert_called_once_with(file_path, 'r') @@ -616,7 +616,7 @@ class ReportTesting(unittest.TestCase): crawler = dt_report.FunctestK8sCrawler() - result = crawler.crawl(testcase, file_path) + result = crawler.crawl(testcase, [file_path]) dt_report.FunctestK8sCrawler.crawl_from_file.assert_called_once_with( 'testcase', 'file_path') @@ -641,7 +641,7 @@ class ReportTesting(unittest.TestCase): file_path = 'file_path' crawler = dt_report.YardstickCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( @@ -678,7 +678,7 @@ class ReportTesting(unittest.TestCase): mock_utils.get_value_from_dict.return_value = 'PASS' crawler = dt_report.YardstickCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -709,7 +709,7 @@ class ReportTesting(unittest.TestCase): mock_utils.get_value_from_dict.return_value = 'PASS' crawler = dt_report.YardstickCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'PASS'} mock_path.exists.assert_called_once_with(file_path) @@ -742,7 +742,7 @@ class ReportTesting(unittest.TestCase): file_path = 'file_path' crawler = dt_report.BottlenecksCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( @@ -768,7 +768,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.BottlenecksCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'PASS'} mock_path.exists.assert_called_once_with(file_path) @@ -796,7 +796,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.BottlenecksCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -821,7 +821,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = {} crawler = dt_report.BottlenecksCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -838,7 +838,7 @@ class ReportTesting(unittest.TestCase): file_path = 'file_path' crawler = dt_report.ShellCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) self.assertEquals(None, result) @@ -851,7 +851,7 @@ class ReportTesting(unittest.TestCase): mock_open.return_value.__enter__.return_value = Exception() crawler = dt_report.ShellCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) mock_open.assert_called_once_with(file_path, 'r') @@ -869,7 +869,7 @@ class ReportTesting(unittest.TestCase): mock_load.return_value = 'result' crawler = dt_report.ShellCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) mock_open.assert_called_once_with(file_path, 'r') @@ -906,7 +906,7 @@ class ReportTesting(unittest.TestCase): file_path = 'file_path' crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(None, file_path) + result = crawler.crawl(None, [file_path]) mock_path.exists.assert_called_once_with(file_path) logger_obj.error.assert_called_once_with( @@ -1041,7 +1041,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'PASS'} mock_path.exists.assert_called_once_with(file_path) @@ -1071,7 +1071,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -1101,7 +1101,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -1133,7 +1133,7 @@ class ReportTesting(unittest.TestCase): mock_loads.return_value = data_dict crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) @@ -1158,7 +1158,7 @@ class ReportTesting(unittest.TestCase): mock_loads.side_effect = ValueError('No JSON object could be decoded') crawler = dt_report.OnapVtpCrawler() - result = crawler.crawl(testcase_obj, file_path) + result = crawler.crawl(testcase_obj, [file_path]) expected = {'criteria': 'FAIL'} mock_path.exists.assert_called_once_with(file_path) |