summaryrefslogtreecommitdiffstats
path: root/dovetail/tests
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2019-08-21 06:02:03 -0400
committerxudan <xudan16@huawei.com>2019-08-27 23:44:31 -0400
commitd15825b04fde0b40df1840ae2ec2fab2ac961471 (patch)
tree53a4a343f560175e7a7b3760d268daf2394f6064 /dovetail/tests
parent14a9a43bf675469486a6991976bef24f3540217b (diff)
Add validation disabled/enabled to results.json
Change-Id: I918f85c5ac89cf2745efa8513946a2b5ab8638b1 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/tests')
-rw-r--r--dovetail/tests/unit/cmd_config.yml4
-rw-r--r--dovetail/tests/unit/test_report.py15
-rw-r--r--dovetail/tests/unit/test_run.py12
3 files changed, 24 insertions, 7 deletions
diff --git a/dovetail/tests/unit/cmd_config.yml b/dovetail/tests/unit/cmd_config.yml
index cc15d64a..405aabce 100644
--- a/dovetail/tests/unit/cmd_config.yml
+++ b/dovetail/tests/unit/cmd_config.yml
@@ -35,3 +35,7 @@ cli:
flags:
- '--opnfv-ci'
is_flag: 'True'
+ noapivalidation:
+ flags:
+ - '--no-api-validation'
+ is_flag: 'True'
diff --git a/dovetail/tests/unit/test_report.py b/dovetail/tests/unit/test_report.py
index 849b31d8..84bd1f38 100644
--- a/dovetail/tests/unit/test_report.py
+++ b/dovetail/tests/unit/test_report.py
@@ -170,12 +170,13 @@ class ReportTesting(unittest.TestCase):
mock_factory.create.assert_called_once_with('type')
checker_obj.check.assert_called_once_with(testcase_obj, None)
+ @patch('dovetail.report.os.getenv')
@patch.object(dt_report.Report, 'get_checksum')
@patch('dovetail.report.Testcase')
@patch('dovetail.report.datetime.datetime')
@patch('dovetail.report.dt_cfg')
def test_generate_json(self, mock_config, mock_datetime, mock_testcase,
- mock_checksum):
+ mock_checksum, mock_env):
logger_obj = Mock()
report = dt_report.Report()
report.logger = logger_obj
@@ -185,6 +186,7 @@ class ReportTesting(unittest.TestCase):
'build_tag': 'build_tag',
'version': '2018.09'
}
+ mock_env.return_value = 'enabled'
utc_obj = Mock()
utc_obj.strftime.return_value = '2018-01-13 13:13:13 UTC'
mock_datetime.utcnow.return_value = utc_obj
@@ -206,6 +208,7 @@ class ReportTesting(unittest.TestCase):
'vnf_checksum': 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
'test_date': '2018-01-13 13:13:13 UTC',
'duration': duration,
+ 'validation': 'enabled',
'testcases_list': [
{
'name': 'ta.tb.tc',
@@ -229,11 +232,12 @@ class ReportTesting(unittest.TestCase):
self.assertEquals(expected, result)
+ @patch('dovetail.report.os.getenv')
@patch('dovetail.report.Testcase')
@patch('dovetail.report.datetime.datetime')
@patch('dovetail.report.dt_cfg')
def test_generate_json_noVNF(self, mock_config, mock_datetime,
- mock_testcase):
+ mock_testcase, mock_env):
logger_obj = Mock()
report = dt_report.Report()
report.logger = logger_obj
@@ -243,6 +247,7 @@ class ReportTesting(unittest.TestCase):
'build_tag': 'build_tag',
'version': '2018.09'
}
+ mock_env.return_value = 'disabled'
utc_obj = Mock()
utc_obj.strftime.return_value = '2018-01-13 13:13:13 UTC'
mock_datetime.utcnow.return_value = utc_obj
@@ -261,6 +266,7 @@ class ReportTesting(unittest.TestCase):
'build_tag': 'build_tag',
'test_date': '2018-01-13 13:13:13 UTC',
'duration': duration,
+ 'validation': 'disabled',
'testcases_list': [
{
'name': 'ta.tb.tc',
@@ -284,11 +290,12 @@ class ReportTesting(unittest.TestCase):
self.assertEquals(expected, result)
+ @patch('dovetail.report.os.getenv')
@patch('dovetail.report.Testcase')
@patch('dovetail.report.datetime.datetime')
@patch('dovetail.report.dt_cfg')
def test_generate_json_noVNF_inTestCase(self, mock_config, mock_datetime,
- mock_testcase):
+ mock_testcase, mock_env):
logger_obj = Mock()
report = dt_report.Report()
report.logger = logger_obj
@@ -298,6 +305,7 @@ class ReportTesting(unittest.TestCase):
'build_tag': 'build_tag',
'version': '2018.09'
}
+ mock_env.return_value = 'enabled'
utc_obj = Mock()
utc_obj.strftime.return_value = '2018-01-13 13:13:13 UTC'
mock_datetime.utcnow.return_value = utc_obj
@@ -316,6 +324,7 @@ class ReportTesting(unittest.TestCase):
'build_tag': 'build_tag',
'test_date': '2018-01-13 13:13:13 UTC',
'duration': duration,
+ 'validation': 'enabled',
'testcases_list': [
{
'name': 'ta.tb.tc',
diff --git a/dovetail/tests/unit/test_run.py b/dovetail/tests/unit/test_run.py
index 497cd06c..0604c8ed 100644
--- a/dovetail/tests/unit/test_run.py
+++ b/dovetail/tests/unit/test_run.py
@@ -528,7 +528,8 @@ class RunTesting(unittest.TestCase):
'opnfv_ci': True,
'report': True,
'testsuite': 'testsuite',
- 'docker_tag': '2.0.0'
+ 'docker_tag': '2.0.0',
+ 'no_api_validation': False
}
with self.assertRaises(SystemExit) as cm:
@@ -544,7 +545,8 @@ class RunTesting(unittest.TestCase):
mock_get_result.assert_called_once_with()
mock_clean.assert_called_once_with()
self.assertEquals({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true',
- 'OPNFV_CI': 'true'}, mock_os.environ)
+ 'OPNFV_CI': 'true', 'validation': 'enabled'},
+ mock_os.environ)
mock_create_logs.assert_called_once_with()
logger_obj.info.assert_has_calls([
call('================================================'),
@@ -619,7 +621,8 @@ class RunTesting(unittest.TestCase):
'opnfv_ci': False,
'report': True,
'testsuite': 'testsuite',
- 'docker_tag': '2.0.0'
+ 'docker_tag': '2.0.0',
+ 'no_api_validation': False
}
with self.assertRaises(SystemExit) as cm:
@@ -636,7 +639,8 @@ class RunTesting(unittest.TestCase):
mock_get_result.assert_called_once_with()
mock_clean.assert_called_once_with()
self.assertEquals({'DOVETAIL_HOME': 'dovetail_home', 'DEBUG': 'true',
- 'OPNFV_CI': 'false'}, mock_os.environ)
+ 'OPNFV_CI': 'false', 'validation': 'enabled'},
+ mock_os.environ)
mock_create_logs.assert_called_once_with()
logger_obj.info.assert_has_calls([
call('================================================'),