Merge "update docs for procedure after host reboot"
[yardstick.git] / yardstick / tests / unit / apiserver / resources / test_env_action.py
1 ##############################################################################
2 # Copyright (c) 2017 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
10 import time
11 import unittest
12
13 from yardstick.tests.unit.apiserver import APITestCase
14
15
16 class EnvTestCase(APITestCase):
17
18     def test_create_grafana(self):
19         if self.app is None:
20             unittest.skip('host config error')
21             return
22
23         url = 'yardstick/env/action'
24         data = {'action': 'create_grafana'}
25         resp = self._post(url, data)
26
27         time.sleep(0)
28
29         task_id = resp['result']['task_id']
30         url = '/yardstick/asynctask?task_id={}'.format(task_id)
31         resp = self._get(url)
32
33         time.sleep(0)
34
35         self.assertTrue(u'status' in resp)
36
37
38 def main():
39     unittest.main()
40
41
42 if __name__ == '__main__':
43     main()