summaryrefslogtreecommitdiffstats
path: root/vnftest/tests
diff options
context:
space:
mode:
authorMoshe <moshehoa@amdocs.com>2019-01-17 18:04:54 +0200
committerMoshe <moshehoa@amdocs.com>2019-01-17 18:05:01 +0200
commit6ed81bdf24927a0900d4857d7652ae48cc8c78b1 (patch)
tree821fff9c7ef18e7ce57ce353e75420900c896948 /vnftest/tests
parent1112c6e3e6eae3aa10680b2d7b0d653de1a4bc0b (diff)
Refactor test reporting
Issue-ID: VNFSDK-350 Change-Id: I66a82ab56dd6702903e4d1edf776a6d29cb4e836 Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/tests')
-rw-r--r--vnftest/tests/unit/core/test_task.py15
-rw-r--r--vnftest/tests/unit/onap/test_rest_call.py5
2 files changed, 11 insertions, 9 deletions
diff --git a/vnftest/tests/unit/core/test_task.py b/vnftest/tests/unit/core/test_task.py
index d554951..7f26d61 100644
--- a/vnftest/tests/unit/core/test_task.py
+++ b/vnftest/tests/unit/core/test_task.py
@@ -26,14 +26,14 @@ from vnftest.core import task
class TaskTestCase(unittest.TestCase):
def test_set_dispatchers(self):
- t = task.Task()
+ t = task.Task({})
output_config = {"DEFAULT": {"dispatcher": "file, http"}}
t._set_dispatchers(output_config)
self.assertEqual(output_config, output_config)
@mock.patch.object(task, 'DispatcherBase')
def test__do_output(self, mock_dispatcher):
- t = task.Task()
+ t = task.Task({})
output_config = {"DEFAULT": {"dispatcher": "file, http"}}
dispatcher1 = mock.MagicMock()
@@ -44,7 +44,7 @@ class TaskTestCase(unittest.TestCase):
mock_dispatcher.get = mock.MagicMock(return_value=[dispatcher1,
dispatcher2])
- self.assertIsNone(t._do_output(output_config, {}))
+ self.assertIsNone(t._do_output(output_config))
@mock.patch.object(task, 'Context')
@mock.patch.object(task, 'base_runner')
@@ -55,16 +55,17 @@ class TaskTestCase(unittest.TestCase):
'interval': 1,
'type': 'Duration'
},
- 'type': 'Dummy'
+ 'type': 'Dummy',
+ 'name': 'Dummy Step'
}
- t = task.Task()
+ t = task.Task({})
runner = mock.Mock()
runner.join.return_value = 0
runner.get_output.return_value = {}
runner.get_result.return_value = []
mock_base_runner.Runner.get.return_value = runner
- t._run([step], False, "vnftest.out", {})
+ t._run([step], 'dummy_case', False, "vnftest.out", {})
self.assertTrue(runner.run.called)
def test_parse_suite_no_constraint_no_args(self):
@@ -121,7 +122,7 @@ class TaskTestCase(unittest.TestCase):
@mock.patch.object(task, 'utils')
@mock.patch('logging.root')
def test_set_log(self, mock_logging_root, *args):
- task_obj = task.Task()
+ task_obj = task.Task({})
task_obj.task_id = 'task_id'
task_obj._set_log()
mock_logging_root.addHandler.assert_called()
diff --git a/vnftest/tests/unit/onap/test_rest_call.py b/vnftest/tests/unit/onap/test_rest_call.py
index 13aced7..b100ecb 100644
--- a/vnftest/tests/unit/onap/test_rest_call.py
+++ b/vnftest/tests/unit/onap/test_rest_call.py
@@ -21,6 +21,7 @@ from vnftest.core import task
class RestCallTestCase(testtools.TestCase):
step = {
+ 'name': 'DummyName',
'type': 'RestCall',
'options': {
'file': "dummy.yaml",
@@ -49,10 +50,10 @@ class RestCallTestCase(testtools.TestCase):
@mock.patch('vnftest.steps.rest_call.RestCall.execute_operation_impl')
def test_run(self, mock_execute_operation):
mock_execute_operation.return_value = {'body': {'value': 'output1'}}
- t = task.Task()
+ t = task.Task({})
context_cfg = {}
context = Context.get("CSAR")
context.init(context_cfg)
t.context = context
- output = t._run([RestCallTestCase.step], False, "vnftest.out", {})
+ output = t._run([RestCallTestCase.step], 'dummy_case', False, "vnftest.out", {})
self.assertEquals(output[0]['data']['output1'], 'output1')