Merge "contexts/node: default to pod.yaml"
[yardstick.git] / tests / unit / api / utils / test_daemonthread.py
1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import unittest
10 import mock
11
12 from api.utils.daemonthread import DaemonThread
13
14
15 class DaemonThreadTestCase(unittest.TestCase):
16
17     @mock.patch('api.utils.daemonthread.os')
18     def test_run(self, mock_os):
19         def func(common_list, task_id):
20             return task_id
21
22         common_list = []
23         task_id = '1234'
24         thread = DaemonThread(func, (common_list, task_id))
25         thread.run()
26
27         mock_os.path.exist.return_value = True
28         pre_path = '../tests/opnfv/test_suites/'
29         mock_os.remove.assert_called_with(pre_path + '1234.yaml')
30
31
32 def main():
33     unittest.main()
34
35
36 if __name__ == '__main__':
37     main()