summaryrefslogtreecommitdiffstats
path: root/dovetail/tests/unit/test_report.py
diff options
context:
space:
mode:
authorStamatis Katsaounis <mokats@intracom-telecom.com>2019-02-01 16:09:57 +0200
committerGeorg Kunz <georg.kunz@ericsson.com>2019-03-07 13:25:01 +0000
commit73b7c7b7f9d78787039dcda96bc3af3155064e13 (patch)
treec5c37d2c8d3a3eb92e252f6e56fbf1610663a8df /dovetail/tests/unit/test_report.py
parent5dda9bb5a5359e46f4c4a47fa9e6bb6cbbe370bc (diff)
Provide a list of check results files instead of one
This patchs gives the ability to provide more than one check results file. Furthermore, it does not alter the behavior of the existing tests but prepares dovetail to be able to fetch information from many sources. Change-Id: I23cd23d2908ad6bdddd94b977813d0e81dc0c05a Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to 'dovetail/tests/unit/test_report.py')
-rw-r--r--dovetail/tests/unit/test_report.py66
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)