From 0e23c697e6329a57ba168cc57886b436ea87cdc4 Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Thu, 17 Nov 2016 08:01:14 +0000 Subject: Create API to run test cases JIRA: YARDSTICK-413 Change-Id: Ibf58b50b568fae3f2eea985b25ee33be0a3666b7 Signed-off-by: chenjiankun --- tests/unit/api/utils/test_daemonthread.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/unit/api/utils/test_daemonthread.py (limited to 'tests/unit/api/utils/test_daemonthread.py') diff --git a/tests/unit/api/utils/test_daemonthread.py b/tests/unit/api/utils/test_daemonthread.py new file mode 100644 index 000000000..918f1f506 --- /dev/null +++ b/tests/unit/api/utils/test_daemonthread.py @@ -0,0 +1,29 @@ +import unittest +import mock + +from api.utils.daemonthread import DaemonThread + + +class DaemonThreadTestCase(unittest.TestCase): + + @mock.patch('api.utils.daemonthread.os') + def test_run(self, mock_os): + def func(common_list, task_id): + return task_id + + common_list = [] + task_id = '1234' + thread = DaemonThread(func, (common_list, task_id)) + thread.run() + + mock_os.path.exist.return_value = True + pre_path = '../tests/opnfv/test_suites/' + mock_os.remove.assert_called_with(pre_path + '1234.yaml') + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() -- cgit 1.2.3-korg