Create API to run test cases
[yardstick.git] / tests / unit / api / utils / test_daemonthread.py
1 import unittest
2 import mock
3
4 from api.utils.daemonthread import DaemonThread
5
6
7 class DaemonThreadTestCase(unittest.TestCase):
8
9     @mock.patch('api.utils.daemonthread.os')
10     def test_run(self, mock_os):
11         def func(common_list, task_id):
12             return task_id
13
14         common_list = []
15         task_id = '1234'
16         thread = DaemonThread(func, (common_list, task_id))
17         thread.run()
18
19         mock_os.path.exist.return_value = True
20         pre_path = '../tests/opnfv/test_suites/'
21         mock_os.remove.assert_called_with(pre_path + '1234.yaml')
22
23
24 def main():
25     unittest.main()
26
27
28 if __name__ == '__main__':
29     main()